This checks all of the pods in all namespaces
- How many static pod are there?
kubectl get pods -A # This checks all of the pods in all namespaces - Need to look at the yaml of the pod if want to know how many static pods exist in the cluster in all namespaces:
kubectl get pod kube-apiserver-controlplane -n kube-system -o yaml - In the
ownerReferencessection of the output, you will see which node the static pod is attached to. It is listed under thekindfield. - What is the path of the directory holding the static pod definition files?
- Can check the
kubeletconf –>/var/lib/kubelet/config.yaml- There you can check the
staticPodPathkey to see the directory of where the pod manifest files are.
- There you can check the
- Can check the
- To check the image of a Static Pod, check
/etc/kubernetes/manifestsandcatthe file manifest file and check theimagefield. - How to create a Static Pod (do not place anything after the
--commandargument):kubectl run static-busybox --image=busybox --dry-run=client -o yaml --command -- sleep 1000 - Redirect it to a file:
kubectl run static-busybox --image=busybox --dry-run=client -o yaml --command -- sleep 1000 > manifest names - Copy the manifest file to
/etc/kubernetes/manifests. - Edit an image on a Static Pod:
- To make any changes on a Static Pod, just edit the file under
/etc/kubernetes/manifests/<POD_NAME> - The pod will
- Then verify with
kubectl get pods --watch
- To make any changes on a Static Pod, just edit the file under
- How to delete a Static Pod?
- Cannot just use
kubectl delete pod. This doesn’t work, as it is a pod that thekubeletmanages. sshinto a node by runningkubectl get nodes -o wideand then access the node using theInternal IPaddress from the command output or the node name.- Again, just to check where the Static Pods directory is, check
/var/lib/kubelet/config.yaml
- Cannot just use