Kubernetes Pod Debugging Cheat Sheet/View pod node selectors and affinity

Inspect scheduling constraints from raw YAML.

Section: Pending and Unschedulable Pods

View pod node selectors and affinity

bash
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.spec.nodeSelector}{"
"}{.spec.affinity}{"
"}'

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Pending and Unschedulable Pods
List Pending pods
Find pods stuck before startup.
OpenIn sheetbashsame section
Inspect node taints
Check whether tolerations are missing.
OpenIn sheetbashsame section
Describe a Pending pod
Look for FailedScheduling, taints, or PVC issues.
OpenIn sheetbashsame section
List PersistentVolumeClaims
Check if pod scheduling is blocked on volume binding.
OpenIn sheetbashsame section
Describe a PVC
Inspect storage class, events, and binding failures.
OpenIn sheetbashsame section
Find CrashLoopBackOff pods
List pods that are restarting and failing to stay up.