gopi m:
Delete pod not deleting container inside it?
Hi @unnivkn , I came across https://stackoverflow.com/questions/51666507/how-can-kube-apiserver-be-restarted|this while exploring kube api server restarts and Nortol mentions that even though pod got deleted, the container remained and the pod restart only created another pod around the old container. This is quite puzzling. Any clarification around this would greatly help!
I am pasting his note for easy ref as well:
Maybe for Deployments, StatefulSets, etc. Today I tested this against cri-o. The delete command recreated the apiserver pod but the container was still running. The same process, as before. This gave me a big headache, because I thought exactly, what you wrote. But my apiserver container mounts a file not controlled by the manifests folder and a change to the configuration was not applied. Only restarting the container via cri-o helped, because the process was killed. The apiserver container process came up immediately because the June controller, I guess. –
Nortol
Mar 29 '21 at 18:08
unnivkn:
Hi @gopi m this is an expected behavior. The answers are already provided in the above link… pls let me know if you have any further questions.
gopi m:
It doesn’t tell as to why the delete pod command didn’t delete the container. Under what situations does this happen?
unnivkn:
Hi @gopi m if the kube-apiserver configuration changes, we need to restart the changes to take effect. if we deploy k8s through kubeadm you can find kube-apiserver static pod. Static pod is not like normal pod, if you need to stop it you have to relocate the /etc/kubernetes/manifest/kube-apiserver.yaml to different location. (eg: to stop: mv /etc/kubernetes/manifest/kube-apiserver.yaml /etc/kubernetes & to start again: mv /etc/kubernetes/kube-apiserver.yaml /etc/kubernetes/manifest/kube-apiserver.yaml). Instead if you try to delete that pod, it will recreate it for you. And the purpose of static pod is not like normal pod. Hope this helps. please go through this link to get more details. https://stackoverflow.com/questions/59612514/whats-the-difference-between-pods-and-static-pods-in-kubernetes-and-when-to
gopi m:
sure, thanks!