Allow scheduling of pods on Kubernetes master?
If you are using Kubernetes 1.7 and above:
kubectl taint node mymasternode node-role.kubernetes.io/master:NoSchedule-
Use the below command to untaint all masters
kubectl taint nodes --all node-role.kubernetes.io/master-
First, get the name of the master
kubectl get nodes
NAME STATUS ROLES AGE VERSION
yasin Ready master 11d v1.13.4
as we can see there is one node with the name of yasin
and the role is master
. If we want to use it as worker we should run
kubectl taint nodes yasin node-role.kubernetes.io/master-
For anyone using kops on AWS. I wanted to enable scheduling of Pods on master.
$ kubectl get nodes -owide
was giving me this output:
NAME STATUS
...
...
ip-1**-**-**-***.********.compute.internal Ready node
ip-1**-**-**-***.********.master.internal Ready,SchedulingDisabled master
^^^^^^^^^^^^^^^^^^
ip-1**-**-**-***.********.compute.internal Ready node
...
...
And $ kubectl describe nodes ip-1**-**-**-***.********.master.internal
:
...
...
Taints: <none>
Unschedulable: true
... ^^^^
...
Patching the master with this command:
$ kubectl patch node MASTER_NAME -p "{\"spec\":{\"unschedulable\":false}}"
worked for me and scheduling of Pods is now enabled.
Ref: https://github.com/kubernetes/kops/issues/639#issuecomment-287015882
I don't know why the master node shows up as NotReady
; it shouldn't. Try executing kubectl describe node mymasternode
to find out.
The SchedulingDisabled
is because the master node is tainted with dedicated=master:NoSchedule
Execute this command against all your masters to remove the taint:
kubectl taint nodes mymasternode dedicated-
To understand why that works read up on taints and tolerations.