I had a Deployment, and a part of it was like this after a few update:
spec:
containers:
- image: myImage
name: myImage
volumeMounts:
- name: data
mountPath: /opt/data
volumes:
- name: data
configMap:
name: configmap-data
- name: data
configMap:
name: configmap-data
then I found that the Deployment had duplicated volumes so I deleted one:
spec:
containers:
- image: myImage
name: myImage
volumeMounts:
- name: data
mountPath: /opt/data
volumes:
- name: data
configMap:
name: configmap-data
However, after that I could not apply/patch new Deployment. It said:
cannot patch "myDeploy" with kind Deployment: Deployment.apps "myDeploy" is invalid: spec.template.spec.containers[0].volumeMounts[0].name: Not found: "data"
I would like to solve this without downtime. How can I do this?