Why Should You Drain a Node Before Upgrading in Kubernetes?

May 1, 2025 4 answers
Asked by pocket 17
I was curious about the reasons for draining a node in a Kubernetes cluster before upgrading it. What kind of issues could arise if a node isn't drained first? For instance, if a node suddenly goes down, how does Kubernetes handle pod eviction in that scenario?

Answers

COIN_toss
It really depends on what you're running on that node. For example, I've seen rook-ceph nodes fail if the kubelet restarts unexpectedly. It's always a good practice to have a strategy for recovery depending on what you're hosting.
Reply to this answer
new.row.started
If a node goes down and doesnโ€™t come back, you might end up with pods stuck in an "Unknown" state, which can require manual force eviction or deletion. Draining the node allows Kubernetes to quickly provision pods on another node, minimizing downtime. Also, don't forget to cordon the node before you drain it!
Reply to this answer
_well_argued_
If a node crashes, Kubernetes loses track of the pods running there and marks them as unknown, waiting for the node to return. Draining or deleting the node in Kubernetes can help to reschedule those podsโ€”draining is the gentler option that respects disruption budgets.
Reply to this answer
spinach harvest
Yeah, if the node goes down suddenly, you'd need to manually delete the pods. That's why draining is saferโ€”having enough replicas and using affinity rules can also help prevent multiple pods of the same workload from ending up on the same node.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions