Skip to main content
In this lesson you will practice manual scheduling in Kubernetes. A Pod manifest file (nginx.yaml) is provided; you will create the Pod, diagnose why it remains Pending, and then manually schedule it to a specific node.

Goals

  • Inspect the cluster and the provided Pod manifest.
  • Create the Pod and determine why it is stuck in Pending.
  • Manually schedule the Pod using spec.nodeName.
  • Verify the Pod is running on the chosen node.

Environment overview

Inspect nodes and the manifest

Check the nodes and list files on the control plane:
Open the provided Pod manifest:

Create the Pod

Create the Pod from the manifest:
Check Pod status:

Why is the Pod Pending?

  • Normally, the kube-scheduler watches for unscheduled Pods and assigns them to nodes. If a Pod has no spec.nodeName, the scheduler should place it on a suitable node.
  • If the kube-scheduler is not running or not available, newly created Pods will remain Pending with Node: <none>.
Inspect the Pod to confirm no node is assigned:
List control plane components in kube-system to verify whether the scheduler Pod exists:
The kube-scheduler normally runs as a Pod (in kube-system). If it is absent or not functioning, newly created Pods that rely on the scheduler will remain Pending unless they already have spec.nodeName set.

Manually schedule the Pod to node01

Since the scheduler is not available, you can force scheduling by setting spec.nodeName in the Pod manifest. Edit nginx.yaml and add nodeName: node01 under spec:. Example updated manifest:
Apply the change by replacing the existing Pod. kubectl replace --force -f deletes and recreates the object:
Monitor the Pod status as it progresses:

(Optional) Schedule the Pod on the control plane node

To run the Pod on the control plane node, change nodeName to controlplane, then recreate the Pod. Remember: you cannot move a running Pod between nodes; you must delete and recreate it.
Kubernetes does not migrate a running Pod (a running process) from one node to another. To change the node, delete the Pod and recreate it (for example by changing spec.nodeName and recreating the Pod).

Notes about deletion timing

When a Pod is deleted, Kubernetes signals the container runtime to terminate the container. Depending on the process handling of termination signals and the Pod’s terminationGracePeriodSeconds, the Pod may take several seconds (or longer) to shut down. This is expected behavior.

Verify where the Pod is running

Use -o wide to show the node the Pod is scheduled on:

Summary

  • A Pod in Pending with Node: <none> and without spec.nodeName generally indicates the kube-scheduler did not assign it (scheduler absent or unavailable).
  • You can manually schedule a Pod by adding spec.nodeName to the Pod manifest and recreating the Pod.
  • Pods cannot be live-migrated between nodes; you must delete and recreate the Pod on the target node.

Watch Video