kubernetes 101 : "kubectl edit" - Troubleshooting the "Error: At least one of apiVersion, kind and name was changed" -
error: At least one of apiVersion, kind and name was changed
For example we have the below pod:
We can modify its parameters using the below command:
After creating the pod using the below command:
We can modify its parameters using the below command:
It opens the editor mentioned in the environment variable (KUBE-EDITOR), then we change the name of the pod to "nginx-pod-changed" for example:
error: At least one of apiVersion, kind and name was changed
Also we get the below message, when we try to change other parameters like the container's port with the "kubectl edit":
The reason is that some parameters like the name of a kubernetes resource, its kind and apiVersion can't be changed.
We would have to delete the resource and re-create it with the new parameters.
An example of a parameter that could be changed using the "kubectl edit" command is the image of the container.
Comments