how to drain the traffic from a pod?

0 votes
I want to take a pod offline for maintenance. How do I drain the traffic from that pod?
Jul 17 in Kubernetes by James
38 views

1 answer to this question.

0 votes

When we take the node for maintenance, pods inside the nodes also take a hit. 

However, we can avoid it by using the below command

kubectl drain <nodename>

When we run the above command it marks the node unschedulable for newer pods then the existing pods are evicted if the API Server supports eviction else it deletes the pods

Once the node is up and running and you want to add it in rotation we can run the below command

kubectl uncordon <nodename>

Note: If you prefer not to use kubectl drain (such as to avoid calling to an external command, or to get finer control over the pod eviction process), you can also programmatically cause evictions using the eviction API.

For more info refer: https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/

answered Jul 17 by Sirajul
• 40,980 points

Related Questions In Kubernetes

+1 vote
1 answer
0 votes
1 answer

Pods IP address from inside a container in the pod

Make sure that your pod yaml file ...READ MORE

answered Aug 29, 2018 in Kubernetes by Kalgi
• 45,780 points
192 views
0 votes
1 answer

Not able to access kubernetes api from a pod in azure

Follow these steps Add --bind-address=0.0.0.0 option to the line https://github.com/kubernetes/kubernetes/blob/v1.2.0/docs/getting-started-guides/coreos/azure/cloud_config_templates/kubernetes-cluster-main-nodes-template.yml#L218  Created ...READ MORE

answered Aug 30, 2018 in Kubernetes by Kalgi
• 45,780 points
87 views
0 votes
1 answer

How to start and stop a cluster on AWS using kops without stopping the instance

Export your KOPS_STAT_STORE variable export KOPS_STATE_STORE=s3://your-bucket-name Get your instances ...READ MORE

answered Jan 8 in Kubernetes by Kashish
1,420 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
3,359 views
+3 votes
1 answer
0 votes
1 answer

how can i access two containers that are inside a pod from the browser with IP address?

Just do port forward. kubectl port-forward [nginx-pod-name] 80:80 kubectl ...READ MORE

answered Jul 18 in Kubernetes by Sirajul
• 40,980 points
58 views
0 votes
1 answer

How to configure a Pod to use the updated configMap?

If the config map is mounted into ...READ MORE

answered Jul 18 in Kubernetes by Sirajul
• 40,980 points
39 views