0
0
KubernetesDebug / FixBeginner · 4 min read

How to Fix Pending Pod in Kubernetes: Quick Debug Guide

A pod stays in Pending state when Kubernetes cannot schedule it on any node, often due to resource shortages or missing node selectors. To fix this, check node availability, resource requests, and scheduling constraints, then adjust your pod spec or cluster resources accordingly.
🔍

Why This Happens

A pod remains in Pending state when Kubernetes cannot find a suitable node to run it. This usually happens because the pod requests more CPU or memory than any node can provide, or because node selectors or taints prevent scheduling.

yaml
apiVersion: v1
kind: Pod
metadata:
  name: example-pod
spec:
  containers:
  - name: busybox
    image: busybox
    command: ['sleep', '3600']
  nodeSelector:
    disktype: ssd
  resources:
    requests:
      memory: "10Gi"
      cpu: "5"
Output
kubectl get pods NAME READY STATUS RESTARTS AGE example-pod 0/1 Pending 0 5m
🔧

The Fix

To fix a pending pod, first check node resources and labels with kubectl get nodes -o wide. Adjust resource requests to fit available capacity or remove restrictive node selectors. Alternatively, add more nodes or update taints and tolerations.

yaml
apiVersion: v1
kind: Pod
metadata:
  name: example-pod
spec:
  containers:
  - name: busybox
    image: busybox
    command: ['sleep', '3600']
  resources:
    requests:
      memory: "100Mi"
      cpu: "0.1"
Output
kubectl get pods NAME READY STATUS RESTARTS AGE example-pod 1/1 Running 0 1m
🛡️

Prevention

To avoid pods staying pending, always request realistic resources matching your cluster capacity. Use kubectl describe pod to check scheduling issues early. Keep node labels and taints updated and monitor cluster resource usage regularly.

⚠️

Related Errors

Other common scheduling errors include ImagePullBackOff when the container image is missing, and CrashLoopBackOff when the container repeatedly fails. Use kubectl describe pod to diagnose these quickly.

Key Takeaways

Pending pods mean Kubernetes cannot find a suitable node to run them.
Check node resources, labels, and pod resource requests to fix scheduling issues.
Adjust pod specs or add cluster resources to resolve pending state.
Use kubectl commands like describe and get nodes to diagnose problems.
Regularly monitor cluster capacity and pod requirements to prevent pending pods.