Hello, i was doing the lab about k8s upgrade, but i noticed something and trying . . .

mk:
hello, i was doing the lab about k8s upgrade, but i noticed something and trying to clear my doubts.
so, i was upgrading the master node, so first i did the drain comand:
kubectl drain controlplane --ignore-daemonsets
so, as i’ve learned drain comands make the node unschedulable and evict all pods are controlled by various components such as replicaset, deployment etc
so i was expecting to see 0 pods on control node but it wasn’t:

[email protected]:~# k get nodes 
NAME           STATUS                     ROLES    AGE   VERSION
controlplane   Ready,SchedulingDisabled   master   68m   v1.19.0
node01         Ready                      <none>   67m   v1.19.0
[email protected]:~# k get pods -A -o wide  | grep -i controlplane
kube-system   etcd-controlplane                      1/1     Running   0          68m     10.32.240.3   controlplane   <none>           <none>
kube-system   kube-apiserver-controlplane            1/1     Running   0          68m     10.32.240.3   controlplane   <none>           <none>
kube-system   kube-controller-manager-controlplane   1/1     Running   0          68m     10.32.240.3   controlplane   <none>           <none>
kube-system   kube-flannel-ds-74wgz                  1/1     Running   0          67m     10.32.240.3   controlplane   <none>           <none>
kube-system   kube-proxy-xcw6b                       1/1     Running   0          67m     10.32.240.3   controlplane   <none>           <none>
kube-system   kube-scheduler-controlplane            1/1     Running   0          68m     10.32.240.3   controlplane   <none>           <none>

so i tried to check who they were controlled by:

[email protected]:~# k describe pod etcd-controlplane -n kube-system | grep -i controlled
Controlled By:  Node/controlplane
[email protected]:~# k describe pod kube-apiserver-controlplane -n kube-system | grep -i controlled
Controlled By:  Node/controlplane

but still having some doubts.
so i would like some clarification about it, so my questions are:
• why are they still running on controlplane, shouldn’t be already evicted ? (i tried also with the --force to check if they will be evicted but nada)
• i can understand etcd is not part of the upgrade, so the rest shouldn’t be in evicted automatically ?
thanks a lot for your explanation! :blush:

Ayush Jain:
The left ones are static pods and daemon sets. You obviously ignored daemon sets.

unnivkn:
Hi @mk system pods are the ones that you can see after you ran the drain command. And these system pods are needed for the normal functionality of k8s cluster, which you already skipped using --ignore-daemonsets. The purpose of drain command is to drain all the application pods hosted on k8s cluster & not the system pods.

mk:
@unnivkn oh, thanks a lot.
now it’s much more clear :smile: