Kubelet and static pods

Exercice 1: retrieve static pod specifications in Kubernetes (kind-based)

Switch to Kubernetes cluster using kubectx kind-kind and then access the control plane Node using docker exec -t -- <my-master-node> sh and then access Kubelet configuration.

Answer
MASTER_NODE=$(kubectl get nodes '--selector=node-role.kubernetes.io/master' -o jsonpath='{.items[0].metadata.name}')

docker exec -t -- kind-control-plane sh -c 'ps -ef | grep "/usr/bin/kubelet"'
docker exec -t -- kind-control-plane sh -c 'cat /var/lib/kubelet/config.yaml | grep -i staticPodPath'
docker exec -t -- kind-control-plane sh -c 'ls /etc/kubernetes/manifests'

Exercice 1: retrieve static pod specifications in Openshift

Switch to Kubernetes cluster using kubectx <my-openshift-context> and then access the control plane Node using oc debug node/<my-master-node> and then access Kubelet configuration.

Answer
MASTER_NODE=$(kubectl get nodes '--selector=node-role.kubernetes.io/master' -o jsonpath='{.items[0].metadata.name}')
oc debug node/"$MASTER_NODE"
chroot /host
ps -ef | grep "kubelet "
cat /etc/kubernetes/kubelet.conf
cat /etc/kubernetes/manifests/kube-apiserver-pod.yaml | jq