Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Kubernetes Troubleshooting: Pods in Pending – Causes & Fixes

Below is a complete, production-grade list of all common reasons why a Kubernetes pod stays in Pending state, along with detailed solutions, commands, and how to verify and fix each issue.



🔍 How to Start Investigating

kubectl describe pod <pod-name>
Code language: HTML, XML (xml)

Focus on the Events: section — it will reveal why the pod is stuck.


🔁 Common Reasons and Solutions

#ReasonError Message / SymptomCommand to DiagnoseHow to Fix
1❌ No available nodes (unschedulable)0/2 nodes are available: Not schedulablekubectl get nodesEnsure at least one node is Ready and schedulable. Use: kubectl uncordon <node>
2❌ Node Taints (control-plane nodes tainted)pod didn't tolerate node taint`kubectl describe nodegrep Taint`
3❌ Node Selectors / Affinity don’t match0/2 nodes match node selector`kubectl get pod -o yamlgrep -A5 nodeSelector`
4❌ Tolerations missing for tainted nodesNo matching tolerations for taintskubectl describe node <node> Check taints:Add toleration in pod spec:yaml<br>tolerations:<br> - key: "example-key"<br> operator: "Exists"<br>
5❌ Insufficient CPU or Memoryinsufficient memory, insufficient cpukubectl describe pod <pod> kubectl describe node <node>Reduce pod resources.requests in YAML:yaml<br>resources:<br> requests:<br> cpu: "100m"<br> memory: "256Mi"<br>
6❌ Too many pods on node (maxPods limit reached)Too many pods`kubectl describe nodegrep pods`
7❌ PersistentVolumeClaim (PVC) pendingpod has unbound PersistentVolumeClaimskubectl get pvcCreate or bind the PVC:kubectl get pvEnsure storage class and capacity match
8❌ ImagePullBackOff (incorrect image or no access)Appears first as Pending, then ContainerCreating, then ImagePullBackOffkubectl describe pod <pod>Check image name and registry authFix typo or use imagePullSecrets
9❌ Missing CNI plugin (pod networking not ready)network plugin is not readykubectl get pods -n kube-systemEnsure CNI is deployed:kubectl apply -f <cni-yaml> (e.g., Calico, Flannel)
10❌ DNS issues inside clusterPods remain stuck in Pending or ContainerCreatingkubectl logs <pod> or kubectl exec -it <pod> -- nslookup kubernetesEnsure kube-dns or CoreDNS is running:kubectl get pods -n kube-system
11❌ Pod Disruption Budgets (PDBs)Not enough available pods to meet the PDBkubectl get pdbAdjust minAvailable or maxUnavailable in your PDB
12❌ InitContainers stuck or failingPod hangs in Init:kubectl describe pod <pod> Check Init: sectionFix issues in the InitContainer: volume mounts, scripts, dependencies
13❌ Pod Quotas / LimitRanges hitLimitRange violated, ResourceQuota exceededkubectl describe quota kubectl describe limitrangeAdjust resource quotas / limits:kubectl edit quota <name>
14❌ Custom Scheduler misconfigurationNo default-scheduler eventskubectl describe pod <pod> check .spec.schedulerNameUse correct scheduler, or omit schedulerName to default to default-scheduler
15❌ No available IPs (CNI limit)Not shown in event, but pod stuckCheck kubelet logs or CNI plugin logsEnsure node’s CNI plugin can allocate more IPs (esp. AWS, Azure)
16❌ Container runtime errors (e.g., containerd/dockerd)Pod stuck in Pending or ContainerCreatingjournalctl -u containerd or docker infoRestart the runtime:sudo systemctl restart containerd
17❌ Cluster Autoscaler delay (in autoscaled clusters)waiting for node scale upkubectl describe pod and look for scaling delay messagesWait or trigger autoscaler node scaling
18❌ Security context or PodSecurityPolicy blocksviolates PodSecurityPolicykubectl describe pod <pod>Ensure pod adheres to allowed securityContext / capabilities
19❌ ServiceAccount or RBAC missingForbidden: ServiceAccount ...kubectl describe podCreate or bind proper ServiceAccount with correct RBAC
20❌ Wrong Namespace usedPod is Pending, PVC not foundkubectl get pods -A kubectl get pvc -AEnsure objects are created in the same namespace or use -n flag

🧪 Bonus: Best Commands for Troubleshooting

# Check events on the pod
kubectl describe pod <pod-name>

# Check node pod limits
kubectl describe node <node-name> | grep -A10 Allocatable

# List all pods on a node
kubectl get pods --all-namespaces -o wide | grep <node-name>

# PVC status
kubectl get pvc

# CNI status
kubectl get pods -n kube-system | grep -E 'cni|calico|flannel'

# Resource quotas
kubectl describe resourcequota
kubectl describe limitrange

# Get pod spec with scheduler/affinity/tolerations
kubectl get pod <pod-name> -o yaml
Code language: PHP (php)

🧭 How to Fix Pending in General

  1. Start with kubectl describe pod
  2. If it says:
    • Too many pods → Increase maxPods or add nodes
    • Insufficient cpu/memory → Reduce resource requests or free up node
    • Taint → Add toleration or remove taint
    • PVC pending → Fix volume
    • No message → Check CNI/DNS

Here is a Bash script that checks for the 20 most common reasons why Kubernetes pods are stuck in Pending state.

✅ It loops over all Pending pods and checks taints, resources, PVCs, tolerations, affinity, maxPods, etc.

📦 You can copy, save as check-pending-pods.sh, and run on your control-plane/master node.


✅ check-pending-pods.sh

#!/bin/bash

echo "=========================="
echo "🔍 Checking Pending Pods..."
echo "=========================="

PENDING_PODS=$(kubectl get pods --all-namespaces --field-selector=status.phase=Pending -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{"\n"}{end}')

if [ -z "$PENDING_PODS" ]; then
  echo "✅ No pending pods found."
  exit 0
fi

echo "$PENDING_PODS" | while read namespace pod; do
  echo ""
  echo "🔍 Analyzing pod: $pod in namespace: $namespace"
  echo "------------------------------------------------"

  # Describe pod
  kubectl describe pod $pod -n $namespace > /tmp/pod_desc.txt

  # 1. Check for failed scheduling
  grep -i "FailedScheduling" /tmp/pod_desc.txt

  # 2. Check node selectors
  echo "🧪 NodeSelector:"
  grep -A2 "Node-Selectors" /tmp/pod_desc.txt

  # 3. Check tolerations
  echo "🧪 Tolerations:"
  grep -A5 "Tolerations:" /tmp/pod_desc.txt

  # 4. Check affinity
  echo "🧪 Affinity:"
  kubectl get pod $pod -n $namespace -o jsonpath='{.spec.affinity}' || echo "None"

  # 5. Check resource requests
  echo "🧪 Resource Requests:"
  kubectl get pod $pod -n $namespace -o jsonpath='{range .spec.containers[*]}{.name}{" => CPU: "}{.resources.requests.cpu}{" | MEM: "}{.resources.requests.memory}{"\n"}{end}'

  # 6. Check PVCs
  echo "🧪 PVCs:"
  PVCs=$(kubectl get pod $pod -n $namespace -o jsonpath='{.spec.volumes[*].persistentVolumeClaim.claimName}')
  for pvc in $PVCs; do
    echo "  🔄 PVC: $pvc => Status: $(kubectl get pvc $pvc -n $namespace -o jsonpath='{.status.phase}')"
  done

  # 7. Check scheduler
  echo "🧪 Scheduler:"
  kubectl get pod $pod -n $namespace -o jsonpath='{.spec.schedulerName}'; echo

  echo ""
done

echo "==============================="
echo "🔍 Checking Node Conditions..."
echo "==============================="

for node in $(kubectl get nodes -o name); do
  echo ""
  echo "Node: $node"
  echo "-----------"

  echo "🧪 Taints:"
  kubectl describe $node | grep Taint || echo "No taints"

  echo "🧪 Allocatable Resources:"
  kubectl describe $node | grep -A10 "Allocatable"

  echo "🧪 Max Pods Limit:"
  kubectl describe $node | grep -A10 Allocatable | grep "pods"
  
  echo "🧪 Running Pods Count:"
  nodeName=$(basename $node)
  kubectl get pods --all-namespaces -o wide | grep $nodeName | wc -l
done

echo ""
echo "✅ Done checking all pending pod conditions!"
Code language: PHP (php)

🧪 How to Use

  1. Save the script:
nano check-pending-pods.sh
# Paste the code
chmod +x check-pending-pods.sh
Code language: CSS (css)
  1. Run the script:
./check-pending-pods.sh

✅ What it Checks

  • Pod scheduling failures
  • Node selectors
  • Tolerations
  • Affinity/anti-affinity
  • CPU/Memory resource requests
  • PVC binding status
  • Scheduler used
  • Taints on nodes
  • Allocatable and used pod count
  • Max pod limits

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Top 10 Integration Platform as a Service (iPaaS) Tools in 2026: Features, Pros, Cons & Comparison

Introduction In today’s fast-paced digital world, businesses are leveraging multiple software applications, cloud services, and data sources to streamline operations. However, the challenge lies in integrating these…

Read More

IReviewed Blog’s Post List

truereviewnow.com is a portal for product review and rating. truereviewnow.com is having very in-depth analysis of review and testimony of Mobiles, Laptop, Electronics Gadgets, Airports, Boradbands, Movies…

Read More

Top 10 Social Media Management Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, social media continues to be a cornerstone of digital marketing strategies, shaping how businesses connect with their audiences. With millions of users interacting on…

Read More

Top 10 Drone Software Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, drones are not only revolutionizing industries like agriculture, logistics, filmmaking, and construction, but also the way we collect and process data. Drone software is…

Read More

Top 10 AI Survey Automation Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI Survey Automation Tools are transforming the way businesses, researchers, and organizations gather and analyze feedback. Traditional survey platforms often relied on static questions…

Read More

Top 10 AI Animation Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI animation tools are revolutionizing how creators, businesses, and educators bring stories to life, making animation accessible to all skill levels. These tools leverage…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x