Skip to content

πŸ› οΈ Manual Scheduling in Kubernetes

By default, Kubernetes uses the scheduler to assign Pods to nodes. But you can manually schedule a Pod by specifying the nodeName field β€” bypassing the scheduler entirely.


🧾 Use Cases

  • Debugging scheduler behavior
  • Manually placing a Pod on a specific node
  • Simple test setups or demos

🧱 YAML Example: Manual Scheduling

apiVersion: v1
kind: Pod
metadata:
  name: manual-pod
spec:
  containers:
  - name: nginx
    image: nginx
  nodeName: worker-node-1

This Pod will only run on worker-node-1, assuming the node exists and is schedulable.


πŸ” Get Available Node Names

kubectl get nodes

🚫 What Happens if Node Is Unavailable?

  • Pod stays in Pending state
  • Events will show FailedScheduling with no matching node

πŸ”„ Switching Back to Scheduler

To let the scheduler choose the node again, simply remove the nodeName field and apply the Pod definition anew.


πŸ§ͺ Alternative: kubectl run with Node Selector

While not full manual scheduling, you can use nodeSelector to influence placement:

kubectl run nginx --image=nginx --overrides='{
  "apiVersion": "v1",
  "spec": {
    "nodeName": "worker-node-1"
  }
}' --dry-run=client -o yaml | kubectl apply -f -

❗ Caution

  • Manual scheduling does not consider taints, affinities, or resource constraints
  • You must know what you're doing β€” there’s no safety net

βœ… Summary

Manual scheduling with nodeName: is useful for learning and debugging, but not recommended for production workloads. Use it only when you need full control over placement and understand the cluster state.