6

Let's Learn About Kubernetes Drain with it's Illustration: - Knoldus Blogs

 2 years ago
source link: https://blog.knoldus.com/lets-learn-about-kubernetes-drain-with-its-illustration/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Reading Time: 3 minutes How to Drain Nodes in Kubernetes With kubectl drain Command

Kubernetes Drain , Hello Readers…In my previous blog we have learn about the commands of cordon. Now Let’s learn about What is Drain in kubernetes.

What is Kubernetes Drain??

We use drain to safely evict all of our pods from a node before you perform maintenance on the node. (e.g. Kernal upgrade, hardware maintenance etc.)

When you drain a node, the scheduler will schedule the evicted pods on different nodes. If there is only one node, if kubernetes delete the pods.

If there are pods controlled by daemon sets they cannot be evicted as they will be scheduled on the same nodes again and again.

So these pods are ignored. We use –force flag to delete it forcefully.

When you drain a node, the node is first cordoned to avoid scheduling of pods during eviction. Then the pods running are evicted.

What is the purpose of node draining?

The node draining allows users to gracefully move all containers from one node to the other ones.

Illustration of Drain:

Note: update your minikube or start your minikube.

1} kubectl get pods

2} kubectl drain minikube

3} kubectl get nodes

4} kubectl drain minikube –ignore-daemonsets –force

5} kubectl get pods

6} kubectl uncordon minikube

7} kubectl get pods

8} kubectl get nodes

9} kubectl drain minikube

10} kubectl drain minikube –ignore-daemonsets –force

The “drain” is waiting for a proper termination. Do not operate the machine until the command is complete.This is all about the Drain in kubernetes.

Hope this blog will helpfull.

Happy Learning

Reference:

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#drain


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK