Kubernetes Pod Pending Hatası: 6 Sebep ve Çözümleri (2025 Rehber)

19.12.2025 10:50 Haber

Kubernetes cluster'ınızda pod'lar "Pending" durumunda mı takılı kaldı (stuck in pending state)? Container'lar oluşmuyor mu? Sakin olun! Alesta Web olarak bu Kubernetes pod pending error'ünü hızlıca çözmenize yardımcı olacağız. Pod'ların pending durumunda kalması (pods staying in pending state) genellikle kaynak yetersizliği veya yapılandırma sorunlarından kaynaklanır. Bu rehberde 6 yaygın sebep ve çözümlerini bulacaksınız.

Pod Pending Durumu Nedir? (What is Pod Pending State?)

Kubernetes'te bir pod "Pending" durumuyla (with pending status) karşılaşıyorsanız, bu pod'un hiçbir node'a atanmadığı (not assigned to any node) anlamına gelir. Scheduler henüz bu pod için uygun bir yer bulamadı.

Pending Durumunu Kontrol Etme (Check Pending Status)

kubectl get pods

# Çıktı örneği:
NAME                     READY   STATUS    RESTARTS   AGE
my-app-7d4b8c9f5-xkzlp   0/1     Pending   0          5m

Gördüğünüz gibi (as you can see), pod "Pending" durumunda ve READY kolonu 0/1 gösteriyor. Bu sorun çözülmeli (this issue needs to be resolved).

Alesta Web ekibi olarak DevOps projelerinde sıkça bu sorunla karşılaşıyoruz. Genelde çözümü basit ama doğru teşhis çok önemli (correct diagnosis is very important).

? Not:

Pending durumu (pending state) başlangıçta normaldir. Eğer pod 2-3 dakikadan uzun süre Pending kalıyorsa (stays pending longer than 2-3 minutes), sorun var demektir.

Sorunun Teşhisi: kubectl describe Komutu (Diagnosing with kubectl describe)

Pod pending sorununda (pod pending problem) ilk adım her zaman aynıdır: Pod'u detaylı incelemek!

Pod Detaylarını İnceleyin (Inspect Pod Details)

kubectl describe pod <pod-name>

# Örnek:
kubectl describe pod my-app-7d4b8c9f5-xkzlp

Bu komut size çok detaylı bilgi verir (gives you very detailed information). En önemlisi "Events" bölümü!

Events Bölümü Örneği (Events Section Example)

Events:
  Type     Reason            Message
  ----     ------            -------
  Warning  FailedScheduling  0/3 nodes are available: insufficient cpu.
  Warning  FailedScheduling  0/3 nodes are available: 1 node(s) had taint {key=value},
                             that the pod didn't tolerate.

İşte sorunun kaynağı! (Here's the source of the problem!) Yukarıdaki örnekte CPU yetersiz (insufficient CPU) veya node taint sorunu var.

Alesta Web olarak size tavsiyemiz: Her zaman önce kubectl describe pod komutuyla başlayın (always start with kubectl describe pod). Bu komut size %90 ihtimalle sorunu gösterir.

Sebep 1: Yetersiz Kaynak (Insufficient Resources)

Bu en yaygın sebep! Pod'unuz 4GB RAM istiyor ama cluster'da sadece 2GB boş var (only 2GB free in cluster). Hadi çözelim:

Node Kaynaklarını Kontrol Edin (Check Node Resources)

kubectl describe nodes

# Özet bilgi için:
kubectl top nodes

Bu komutlar size her node'un CPU ve memory kullanımını gösterir (shows CPU and memory usage of each node).

Çözüm Seçenekleri / Solution Options:

Seçenek 1: Pod Resource Request'lerini Azaltın

# deployment.yaml dosyasını düzenleyin
apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
      - name: my-app
        image: my-app:1.0
        resources:
          requests:
            memory: "256Mi"  # 4Gi yerine 256Mi
            cpu: "250m"      # 1000m yerine 250m

Seçenek 2: Cluster'a Yeni Node Ekleyin (Add New Node to Cluster)

# Eğer cloud provider kullanıyorsanız:
# AWS EKS
eksctl scale nodegroup --cluster=my-cluster --name=my-nodegroup --nodes=5

# GKE
gcloud container clusters resize my-cluster --num-nodes=5

# Azure AKS
az aks scale --resource-group myRG --name myCluster --node-count 5

Yeni node ekleyince (after adding new nodes) Kubernetes otomatik olarak pending pod'ları oraya yerleştirecektir.

⚠️ Dikkat / Warning:

Resource limit'leri çok düşük tutmayın (don't set resource limits too low)! Uygulama çalışırken crash olabilir. Alesta Web tavsiyesi: Önce gerçek kullanımı izleyin (monitor actual usage first), sonra optimize edin.

Sebep 2: Node Taints ve Tolerations

Bazı node'lar "taint" ile işaretlenmiştir (marked with taints). Bu node'lara sadece belirli pod'lar atanabilir (only specific pods can be assigned). Mesela bir node sadece GPU workload'ları için ayrılmış olabilir.

Node Taint'lerini Kontrol Edin (Check Node Taints)

kubectl describe node <node-name> | grep Taints

# Örnek çıktı:
Taints: dedicated=gpu:NoSchedule

Bu durumda (in this case), sadece GPU tolerasyonu olan pod'lar bu node'a atanabilir (only pods with GPU toleration can be assigned).

Çözüm: Toleration Ekleyin (Add Toleration)

# deployment.yaml
apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      tolerations:
      - key: "dedicated"
        operator: "Equal"
        value: "gpu"
        effect: "NoSchedule"
      containers:
      - name: my-app
        image: my-app:1.0

Artık pod bu taint'li node'a atanabilir (now pod can be assigned to this tainted node).

Alternatif: Taint'i Kaldırın (Remove Taint)

kubectl taint nodes <node-name> dedicated=gpu:NoSchedule-

# '-' işareti taint'i kaldırır (minus sign removes taint)

Ancak dikkatli olun! Eğer node özel bir amaç için (for a special purpose) ayrılmışsa taint'i kaldırmak sorun yaratabilir.

Alesta Web ekibinin deneyimine göre (according to Alesta Web team's experience), production cluster'larında taint yönetimi çok önemlidir. Her node'u amacına göre etiketleyin (label each node according to its purpose).

Sebep 3: PersistentVolumeClaim (PVC) Sorunları

Pod'unuz bir storage volume bekliyor ama oluşturulamıyor (waiting for storage volume but it cannot be created)? İşte çözüm:

PVC Durumunu Kontrol Edin (Check PVC Status)

kubectl get pvc

# Çıktı:
NAME        STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
my-pvc      Pending   ...      ...        ...            standard       5m

Eğer PVC "Pending" durumundaysa (if PVC is in pending state), pod da başlayamaz (pod also cannot start).

PVC Detaylarını İnceleyin (Inspect PVC Details)

kubectl describe pvc my-pvc

# Events bölümüne bakın:
Events:
  Type     Reason              Message
  ----     ------              -------
  Warning  ProvisioningFailed  Failed to provision volume: no volume plugin matched

Çözüm Yöntemleri / Solution Methods:

1. StorageClass Var mı Kontrol Edin (Check if StorageClass Exists)

kubectl get storageclass

# Eğer yoksa oluşturun (if not exists, create):
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard
provisioner: kubernetes.io/aws-ebs  # Cloud provider'a göre değişir
parameters:
  type: gp2

2. Manuel PersistentVolume Oluşturun (Create Manual PV)

apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-pv
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"

Ama dikkat! hostPath sadece test için uygun (hostPath only suitable for testing). Production'da cloud storage kullanın (use cloud storage in production).

alestaweb.com üzerindeki Kubernetes storage rehberlerimizde daha detaylı bilgi bulabilirsiniz (you can find more detailed information).

Sebep 4: Node Selector/Affinity Kuralları

Pod'unuz belirli bir node'da çalışmak istiyor ama o node yok veya dolu (that node doesn't exist or is full)? Şöyle kontrol edelim:

NodeSelector Kontrolü (NodeSelector Check)

kubectl get pod <pod-name> -o yaml | grep -A 5 nodeSelector

# Çıktı:
nodeSelector:
  disktype: ssd
  region: us-east

Pod sadece "disktype=ssd" ve "region=us-east" label'lı node'lara atanabilir (pod can only be assigned to nodes with these labels).

Uygun Node Var mı? (Is There a Matching Node?)

kubectl get nodes --show-labels | grep "disktype=ssd"

# Eğer çıktı boşsa, uygun node yok!

Çözüm 1: Node'a Label Ekleyin (Add Label to Node)

kubectl label nodes <node-name> disktype=ssd region=us-east

Çözüm 2: NodeSelector'ı Kaldırın veya Değiştirin (Remove or Modify NodeSelector)

kubectl edit deployment my-app

# nodeSelector kısmını silin veya düzenleyin
# Sonra kaydedin (:wq)
? Alesta Web İpucu:

NodeAffinity kullanıyorsanız (if using NodeAffinity), "required" yerine "preferred" kullanın. Böylece pod kesinlikle atanır (this way pod will definitely be assigned), ama tercih edilen node'larda çalışır.

Sebep 5: Image Pull Hataları (Image Pull Errors)

Bazen pod pending değil "ImagePullBackOff" durumundadır ama bu da schedule sorununa yol açabilir (this can also lead to scheduling issues).

Image Pull Durumu (Image Pull Status)

kubectl describe pod <pod-name> | grep -A 10 Events

Events:
  Warning  Failed     Failed to pull image "my-registry/my-app:latest":
           rpc error: code = Unknown desc = Error response from daemon:
           pull access denied

Çözüm: ImagePullSecret Ekleyin (Add ImagePullSecret)

# Önce secret oluşturun
kubectl create secret docker-registry my-registry-secret \
  --docker-server=my-registry.com \
  --docker-username=myuser \
  --docker-password=mypassword

# Sonra deployment'a ekleyin:
spec:
  template:
    spec:
      imagePullSecrets:
      - name: my-registry-secret

Artık pod private registry'den image çekebilecek (now pod can pull image from private registry). Alesta Web olarak Docker registry yönetimi hakkında da kapsamlı rehberlerimiz var.

Sebep 6: Kubernetes Scheduler Sorunları

Nadiren scheduler'ın kendisi sorunlu olabilir (rarely the scheduler itself can be problematic). Kontrol edelim:

Scheduler Durumu (Scheduler Status)

kubectl get pods -n kube-system | grep scheduler

# Çıktı:
kube-scheduler-master-1   1/1   Running   0   5d

Eğer scheduler "Running" değilse (if scheduler is not running), sorun burada!

Scheduler Log'larını İnceleyin (Check Scheduler Logs)

kubectl logs -n kube-system kube-scheduler-master-1

Log'larda error mesajları arayın (search for error messages in logs).

Çözüm: Scheduler'ı Yeniden Başlatın (Restart Scheduler)

kubectl delete pod -n kube-system kube-scheduler-master-1

# Kubernetes otomatik olarak yenisini oluşturur
# (Kubernetes automatically creates a new one)

Önleme Stratejileri ve Best Practices (Prevention Strategies)

Alesta Web ekibinin production Kubernetes cluster'larında uyguladığı (applies in production clusters) en iyi pratikler:

Strateji (Strategy) Açıklama (Description)
Resource Limits Belirle Her pod için doğru request/limit değerleri (correct request/limit values)
Monitoring Kur Prometheus + Grafana ile kaynak izleme (resource monitoring)
Auto-scaling Kullan HPA (Horizontal Pod Autoscaler) ve Cluster Autoscaler
Node Pool Stratejisi Farklı workload'lar için ayrı node pool'lar (separate node pools)
PodDisruptionBudget Minimum available pod sayısını garanti et (guarantee minimum available pods)
✅ Pro Tip:

alestaweb.com üzerindeki Kubernetes monitoring rehberimizi mutlaka okuyun (definitely read our monitoring guide). Sorunları önceden tespit etmek (detecting problems in advance) çok önemli!

? Kaynaklar ve Referanslar / Sources and References

Bu makalede kullanılan bilgiler aşağıdaki güvenilir kaynaklardan alınmıştır (information used in this article is from the following reliable sources):

Alesta Web olarak tüm bilgileri doğruladık ve production ortamlarında test ettik (we verified and tested all information in production environments).

✅ Artık Kubernetes Pod Pending Sorunları Geride Kaldı! (Pod Pending Issues Are Now Behind!)

Alesta Web olarak size Kubernetes pod pending hatası (Kubernetes pod pending error) için 6 yaygın sebep ve çözüm sunduk. Bu rehberdeki adımları izleyerek sorunları hızlıca çözebilirsiniz (you can quickly solve problems by following the steps).

Hızlı Kontrol Listesi / Quick Checklist:

  • ✅ kubectl describe pod ile sorun teşhisi yaptınız mı? (Did you diagnose with kubectl describe pod?)
  • ✅ Node kaynaklarını kontrol ettiniz mi? (Did you check node resources?)
  • ✅ Taint ve toleration ayarlarını gözden geçirdiniz mi? (Did you review taint and toleration settings?)
  • ✅ PVC durumunu kontrol ettiniz mi? (Did you check PVC status?)
  • ✅ NodeSelector/Affinity kurallarını doğruladınız mı? (Did you verify NodeSelector/Affinity rules?)
  • ✅ Image pull secret'ları ayarladınız mı? (Did you configure image pull secrets?)

Hatırlayın: Kubernetes pod pending hatası (Kubernetes pod pending error) genellikle kaynak veya yapılandırma sorunudur. kubectl describe komutu size %90 sorunun kaynağını gösterir (shows the source of the problem 90% of the time).

Faydalı Linkler / Useful Links:

  • Alesta Web Ana Sayfa: alestaweb.com - Daha fazla Kubernetes ve DevOps rehberi (More Kubernetes and DevOps guides)
  • Kubernetes Deployment Rehberleri: alestaweb.com - Production deployment best practices
  • Docker ve Container Yönetimi: alestaweb.com - Kapsamlı container rehberleri (Comprehensive container guides)
? Yardıma mı İhtiyacınız Var?

Kubernetes cluster yönetimi (Kubernetes cluster management) konusunda sorularınız mı var? Alesta Web ekibi DevOps ve Kubernetes konularında size yardımcı olmaya hazır! alestaweb.com üzerinden bize ulaşabilirsiniz.

© 2025 AlestaWeb - Tüm hakları saklıdır. Bu rehber Alesta Web tarafından hazırlanmıştır.

WM Tools
💫

WebMaster Tools

15 Profesyonel Araç