?? Kubernetes Interview Question & Pro Tips: Mastering Static Pods! ??
Abhishek kumar
Serving Notice Period || AWS || DevOps || Jenkins || Docker || Kubernetes || Terraform || Argo CD || Shell Scripting
?? Kubernetes Tip of the Day: Understanding Static Pod Definitions! ??
?? Q: What is the path of the directory holding the static pod definition files?
?? Step 1: Identify the kubelet config file:
ps -aux | grep /usr/bin/kubelet
?? Output Example:
--config=/var/lib/kubelet/config.yaml
?? Step 2: Check the staticPodPath in the kubelet config file:
grep -i staticpod /var/lib/kubelet/config.yaml
? Result:
staticPodPath: /etc/kubernetes/manifests
??? Path Found: /etc/kubernetes/manifests
?? Note: The path may vary. Always check the kubelet configuration file!
?? Q: How to delete a static pod named static-redbox?
1?? Find the node with the pod:
kubectl get pods --all-namespaces -o wide | grep static-redbox
2?? SSH into the identified node:
ssh <node_name>
3?? Identify the kubelet config file:
ps -ef | grep /usr/bin/kubelet
4?? Find the staticPodPath:
grep -i staticpod /var/lib/kubelet/config.yaml
5?? Navigate to the directory:
cd <output_path>
6?? Delete the static pod file:
rm -rf static-redbox.yaml
7?? Logout from the node:
ctrl+d or exit
8?? Verify deletion: Check if the pod is deleted!
?? Pro Tip: By default, static pods are usually created for control plane components, so look on the control plane node first!
?? Have you ever dealt with static pods in Kubernetes? Share your experiences or ask questions below! ??
?? follow for more Kubernetes tips! ??