Mahmoud Abdelfatah:
Hi dears,
i am working on Upgrading kubeadm cluster version:
• to install kubelet in any node, why should i issue a “drain” command before installation??, before this step i have already upgraded kubeadm and applied the upgrade for controleplane components.
• after drain: i still see the static-pod components like kube-apiserver & kube-scheduler , also i still see daemonset components, only the replicasets moved to another worker node.
i listed the last point because i already know that when we apply the drain command to the node, if this node returned to work, it should had to be in a blanked state, which means: all resources were lost and recreated on another node only if they already a part of a replicaset, not a static pod or daemonset.
thank u in advance
Radoslaw Czajkowski:
you need to use drain because you can have some app running on a node so you would like to have the app still running during the time you are upgrading the kubelet
Radoslaw Czajkowski:
drain “moves” the app to a different node - in case it is a deployment or a replicaset
Radoslaw Czajkowski:
static pods cannot be recreated on another node as they are bound to the node itself (but they will be recreated after the kubelet is upgraded)
Radoslaw Czajkowski:
deamonset can be ignored (hence the flag –ignore-daemonsets) because deamoset managed pods run usually on every node in a cluster
Radoslaw Czajkowski:
but manually created pods (not managed by replicaset/deployment) will be lost during the upgrade (so the app can stop working) - try this one in your lab, try to drain a node with a pod created imperatively “kubectl run nginx --image=nginx” and see what happens - drain will not work unless you add “–force”.
Mahmoud Abdelfatah:
thank you @Radoslaw Czajkowski
i can understand now, but for static pods i can see them up and running in the controleplane after draining, are they should be deleted till i upgrade the kubelet and remove the cordon ?
unnivkn:
Hi @Mahmoud Abdelfatah static pod are system pods which is needed for the k8s-cluster functionality. So please don’t worry about that. During drain, you have to make sure that all application pods are relocated/recreated to the adjacent nodes. Static pods purpose is not to serve the application loads.
fyr: https://stackoverflow.com/questions/59612514/whats-the-difference-between-pods-and-static-pods-in-kubernetes-and-when-to