Why There is No Kubernetes Pod on the Master Node

You may have noticed that the Scheduler doesn’t schedule any Pod to master node. Only worker nodes have pods. Let’s take a look at why.
The reason
When the Kubernetes cluster is first set up, a Taint is set on the master node. This automatically prevents any pods from being scheduled on this node. You can see this as well as modify this behavior if required. However, a best practice is not to deploy application workloads on a master server. To see this taint, run a kubectl describe node command with kubemaster which has the node name and look for the “Taint” section. You will see a Taint set to not schedule any pod on the master node.

Here are the steps to schedule pods on the master nodes:
Remove the taint from the master nodes: By default, the master nodes have a taint that prevents pods from being scheduled on them. To remove the taint, run the following command:
kubectl taint nodes <node-name> node- role.kubernetes.io/master:NoSchedule-Replace
<node-name>with the name of the master node.Override the node selector: By default, the master nodes are labeled with a node role label that indicates they are not suitable for running user workloads. You can override the node selector to schedule pods on the master nodes by specifying the appropriate label selector in the pod spec.
apiVersion: v1 kind: Pod metadata: name: my-pod spec: containers: - name: my-container image: nginx nodeSelector: node-role.kubernetes.io/master: ""This pod specification includes an empty value for the
node-role.kubernetes.io/masternode selector label, which allows the pod to be scheduled on any node, including the master nodes.
Note that scheduling pods on the master nodes can potentially affect the stability and availability of the cluster, so it is generally not recommended. You should carefully consider the implications before doing so and ensure that you have appropriate safeguards and monitoring in place.


![Ansible Tower [ AWX ] Installation on k8's](https://cdn.hashnode.com/res/hashnode/image/upload/v1712374070527/cabbd1a9-6568-4e02-a445-f4eb6ecd89e2.png)

![Amazon S3 [Simple Storage Service]](https://cdn.hashnode.com/res/hashnode/image/upload/v1684416654204/c9dcd465-9d73-4e0b-b55e-ba113358db89.png)