A kubectl plugin that diagnoses why pods are stuck in Pending state by analyzing node constraints, taints, tolerations, and events.
- Node Selector Analysis: Checks if any nodes match the pod's nodeSelector requirements
- Taint/Toleration Validation: Identifies missing tolerations for node taints
- Pod Events: Shows recent events related to the pending pod
- Karpenter Integration: Optional diagnostics for Karpenter-managed clusters
- NodePool Analysis: Analyzes Karpenter NodePools for capacity and compatibility issues
kubectl krew install why-pending# Download the binary for your platform
curl -L https://github.com/cilasbeltrame/why-pending/releases/latest/download/why-pending-$(uname -s)-$(uname -m) -o why-pending
chmod +x why-pending
sudo mv why-pending /usr/local/bin/kubectl-why-pendingkubectl why-pending -n <namespace> -pod <pod-name>kubectl why-pending -n <namespace> -pod <pod-name> --karpenterkubectl why-pending \
-n my-namespace \
-pod my-pod \
--kubeconfig ~/.kube/config \
--context my-cluster \
--karpenter \
--karpenter-namespace karpenter \
--karpenter-since 1h \
--karpenter-raw-logs| Flag | Description | Default |
|---|---|---|
-n, --namespace |
Target namespace | default |
-pod |
Pod name (required) | - |
--kubeconfig |
Path to kubeconfig file | ~/.kube/config |
--context |
Kubernetes context | Current context |
--karpenter |
Enable Karpenter diagnostics | false |
--karpenter-namespace |
Karpenter controller namespace | karpenter |
--karpenter-since |
How far back to read logs | 30m |
--karpenter-raw-logs |
Show raw log lines | false |
kubectl why-pending -n production -pod web-app-7d4f8b9c6-xyz12kubectl why-pending -n production -pod web-app-7d4f8b9c6-xyz12 --karpenterThe plugin provides a structured analysis:
- Pod Status: Current phase and scheduling conditions
- Node Selector: How many nodes match the pod's requirements
- Taints/Tolerations: Compatibility analysis with suggested fixes
- Pod Events: Recent events that might explain the issue
- Karpenter Analysis (optional): Controller logs and NodePool compatibility
- Missing nodeSelector matches
- Incompatible taints without proper tolerations
- Resource constraints in Karpenter NodePools
- Instance type or availability zone limitations
- Capacity limits reached
Contributions are welcome! Please feel free to submit issues and pull requests.
MIT License