Manual scheduling pods in Kubernetes

Every Pod has a field called nodeName that by default is not set. Kubernetes will create this field automatically.

The scheduler goes through the all Pods and looks for those that don’t have this property set. Those are the candidates for the scheduling. It then identifies the right node for the Pod by running the scheduling the algorithm. Once identified, it schedules the Pod on the node by setting the nodeName property to the name of the node by creating the binding object.

If there is no scheduler to monitor and schedule a node what happens? The pods continue to the in a pending stage.
So what can we do about it. We can manually assign the Pods to nodes yourself.

Without a scheduler the easiest way to schedule a Pod is to simply set the nodeName field to the name of the node in your Pod specification file while creating the Pod. The Pod then gets assigned to the specified node.

nodeName is a field in the Pod spec. If the nodeName field is not empty, the scheduler ignores the Pod and the kubelet on the named node tries to place the Pod on that node.

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx
  nodeName: node-01