Static Pods - kubectl edit command

Hi, I have a query regarding static pods. After going through lesson on static pods, i understand that api-server keeps readonly information of static pods and thus kubectl provides information of static pods as well. All good till now, my expectation was that i should not be able to edit the static pods using kubectl but instead when i tried to make change using kubectl edit command for static pod, i was allowed, it did not change pod definition in manifest folder and that is expected but how did it allow to change static pod? is it because kubectl edit do in memory update so it does not go back to api-server??

As far as I know, using kubectl edit won’t change the image of the a static pod, since, as you correctly point out, a static pod is not being stored in etcd; the edit command is working on a read-only copy of the pod. And it certainly won’t edit the manifest file; you need to do that using a text editor like vim.

still its not clear to me. if it is readonly how am i able to edit the pod ?
for example i was able to add labels to the pod, even delete the pod with kubectl.

then what part is readonly in static pods ?

Hi @vajravelu,

The static pod is usually found in the /etc/kubernetes/manifests/ directory on the node. You can update it by using vim or nano to edit the file directly on the node.

@raymond.baoly

this is not answering the OP , neither my question in the replies. not sure how its related at all.
here the OP and i am talking about static pods being editable with kubectl edit command.
and not editing the pods in manifests directory.

No, it was indeed answered: kubectl edit doesn’t really work with a static pod. I’m not sure if the edit creates an actual error, but using kubectl edit will not actually update a static pod. The only way to update a static pod is to edit the manifest file. The kubelet that runs the node where the manifest file will reload the pod from disk. But since kubectl edit does not change the manifest file, it will do nothing to update the static pod.