DEV Community

Cover image for Kubernetes: Make a control plane node a worker
Sergio Peris
Sergio Peris

Posted on • Originally published at sertxu.dev

Kubernetes: Make a control plane node a worker

When creating a small Kubernetes cluster with 3 nodes, you might want to make the control plane node also a worker. Remember that on larger clusters it's recommended to not mix the responsabilities os the nodes.

To make a control plane node a worker you should run the following command:

kubectl label node <node-name> node-role.kubernetes.io/worker=worker
Enter fullscreen mode Exit fullscreen mode

If we check the nodes status we cna see the first node now has both control-plane and worker roles.

kubectl get nodes
Enter fullscreen mode Exit fullscreen mode
NAME                           STATUS   ROLES                  AGE   VERSION
eu-central-1.binarycomet.net   Ready    control-plane,worker   78m   v1.32.3
eu-central-2.binarycomet.net   Ready    worker                 53m   v1.32.3
eu-central-3.binarycomet.net   Ready    worker                 25m   v1.32.3
Enter fullscreen mode Exit fullscreen mode

The control plane might be tainted to not accept pods, you can check if that's your case running:

kubectl get nodes eu-central-1.binarycomet.net -o json | jq '.spec.taints'
Enter fullscreen mode Exit fullscreen mode

If it's tainted it will output something similar to this, as you can see the effect NoSchedule tells the cluster this node cannot be the host of pods.

[
  {
    "effect": "NoSchedule",
    "key": "node-role.kubernetes.io/control-plane"
  }
]
Enter fullscreen mode Exit fullscreen mode

To remove that effect run the following command, if your taint key is different adapt it to your cluster:

kubectl taint nodes eu-central-1.binarycomet.net node-role.kubernetes.io/master:NoSchedule-
Enter fullscreen mode Exit fullscreen mode

Top comments (0)