Search code examples
kubernetesminikubekubernetes-pod

How are pods in kube-system namespace managed?


I'm trying to understand how kubernetes works, so I tried to do this operation for my minikube:

~ kubectl delete pod --all -n kube-system
pod "coredns-f9fd979d6-5n4b6" deleted
pod "etcd-minikube" deleted
pod "kube-apiserver-minikube" deleted
pod "kube-controller-manager-minikube" deleted
pod "kube-proxy-879lg" deleted
pod "kube-scheduler-minikube" deleted

It's okay. Pods deleted as wish. But if I do kubectl get pods -n kube-system I will see:

NAME                               READY   STATUS    RESTARTS   AGE
coredns-f9fd979d6-5d25r            1/1     Running   0          50s
etcd-minikube                      1/1     Running   0          50s
kube-apiserver-minikube            1/1     Running   0          50s
kube-controller-manager-minikube   1/1     Running   0          50s
kube-proxy-nlw69                   1/1     Running   0          43s
kube-scheduler-minikube            1/1     Running   0          49s

Okay. I thought it's ReplicaSet or DaemonSet:

➜  ~ kubectl get ds -n kube-system
NAME         DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
kube-proxy   1         1         1       1            1           kubernetes.io/os=linux   18m
➜  ~ kubectl get rs -n kube-system
NAME                DESIRED   CURRENT   READY   AGE
coredns-f9fd979d6   1         1         1       18m

It is true for coredns and kube-proxy. But what about others (apiserver, etcd, controller and scheduler)? Why are they still alive?


Solution

  • The control plane pods are run as static Pods - static Pods are not managed by the control plane controllers like e.g. DaemonSet and ReplicaSet. Static pods are instead managed by the Kubelet daemon on the local node directly.