I'm aware that running a pod(s) on a master node(s) is against kubernetes best practices! Nevertheless, in my virtual environment, I'd like to run a pod on a master node. How can I do that?
I found a solution. You can remove taint
that prohibits kubernetes scheduler
to schedule pods on a master node(s).
# Get all nodes.
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
compute01 Ready compute 16d v1.15.0
master Ready master 16d v1.15.0
web01 Ready web 16d v1.15.0
# Check if there is a NoSchedule taint on master node.
$ kubectl get node master -o json
...
"taints": [
{
"effect": "NoSchedule",
"key": "node-role.kubernetes.io/master"
}
]
...
# Delete node-role.kubernetes.io/master taint from all nodes that have it.
$ kubectl taint nodes --all node-role.kubernetes.io/master-
node "node/master" untainted
taint "node-role.kubernetes.io/master" not found
taint "node-role.kubernetes.io/master" not found
If you want make you master node schedulable again then, you will have to recreate deleted taint with bellow command.
$ kubectl taint node master node-role.kubernetes.io/master=:NoSchedule
node/master tainted