Vim, Nano is not able to save - CKA labs - error controlplane $ kubectl edit pod ubuntu-sleeper Edit cancelled, no changes made. controlplane $ kubectl edit pod ubuntu-sleeper Edit cancelled, no changes made."

Hi,

I am trying to run security lab from CKA certification course. While saving the changes as per exercise in VM/Nano I am getting following error. Any help is appreciated.

controlplane kubectl edit pod ubuntu-sleeper Edit cancelled, no changes made. controlplane kubectl edit pod ubuntu-sleeper
Edit cancelled, no changes made.

You cant edit the pod. You can edit only deployment. If you want to change anything in pod, you need to take a pod yaml output and then update your changes and recreate the pod.

1 Like

Hello, @ideafest
You can only change containers image, initContainers image and tolerations while pod is in running phase. Other fields cannot be edit because of immutability.
As Sathish said, you can prefer that method. Otherwise it will create a temporary file in the path /tmp/kubectl-edit-xxxxxx. All your changes saved in that file.
In this situation, you can do two things to deploy pod from new manifest file.

  1. First delete the pod with --force --grace-period 0 command to delete without any delay.
  2. Use kubectl replace command to delete the existing one and then deploy new pod what is written in the file.
    Well that’s it for now. Please test in the labs so you’ll get hands of experience. :+1:
1 Like

Thank you Sathish and Player001. Your response really helped me understand it better. Let me give another try. This community is awesome!