Wednesday, November 21, 2018

The Easy Way To Let Kubernetes Master Node To Run Pods

Symptom:

   By default, as Kubernetes master node has quite heavy admin load, so it normally does not  run other work pods.  However when we don't have many nodes, so we would like to let master node to run some workload too ,specially in Dev and Stage enviroments.

Solution:

    There are a few ways to do that. The easy way is to remove the taint of the master node.
Default, master has taint like this:
kubectl describe node <master node>  |grep -i taint
Taints:             node-role.kubernetes.io/master:NoSchedule

We remove it via kubectl
kubectl taint nodes <master node>  node-role.kubernetes.io/master-
node "<master node>" untainted
or
kubectl taint nodes <master node> node-role.kubernetes.io:NoSchedule-
node "<master node>" untainted
When we scale up pods, some of them will run on master node

We can add it back via kubectl
 kubectl taint nodes<master node>  node-role.kubernetes.io=master:NoSchedule
node "<master node>" tainted

We can  use taint to prevent pod schedules on normal worker node as well.
kubectl taint nodes <node> key=value:NoSchedule

No comments:

Post a Comment