INFRA-DEVOPS Contents

Scheduling Basics (taints/affinity/topology)

Control scheduling with taints/tolerations, affinity, and topology spread; diagnose why pods stay Pending.

On this page

Why Pods Stay Pending

  • Insufficient resources (CPU/memory/PVC).
  • Taints without tolerations.
  • Affinity/topology constraints too strict.

First Commands

kubectl -n <ns> get pod <pod> -o wide
kubectl -n <ns> describe pod <pod> | sed -n '1,260p'
kubectl get nodes -o wide
kubectl describe node <node> | sed -n '1,220p'

Taints / Tolerations

kubectl describe node <node> | grep -n 'Taints' -A2
kubectl -n <ns> get pod <pod> -o jsonpath=' {.spec.tolerations}{"
"}'

Affinity / Topology Spread

kubectl -n <ns> get pod <pod> -o jsonpath=' {.spec.affinity}{"
"}' | head -40
kubectl -n <ns> get pod <pod> -o jsonpath=' {.spec.topologySpreadConstraints}{"
"}' | head -60

Failure Modes

  • Over-constrained: anti-affinity + topology spread + small cluster → no placement.
  • Dedicated nodes: taints block general workloads.
  • Zone mismatch: PVC bound in zone A, pod scheduled in zone B.