Ulaşım
- Adres:Batıkent Mh. 8910 Sk. 6. Etap 1H No: 18 Yeni Toki Eyyübiye / Şanlıurfa (Yeni Alım Satım Karşısı)
- Telefon:0 (545) 528 88 93
- eMail: info@alestaweb.com
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.
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ı.
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).
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.
Pod pending sorununda (pod pending problem) ilk adım her zaman aynıdır: Pod'u detaylı incelemek!
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:
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.
Bu en yaygın sebep! Pod'unuz 4GB RAM istiyor ama cluster'da sadece 2GB boş var (only 2GB free in cluster). Hadi çözelim:
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).
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.
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.
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.
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).
# 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).
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).
Pod'unuz bir storage volume bekliyor ama oluşturulamıyor (waiting for storage volume but it cannot be created)? İşte çözüm:
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).
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
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).
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:
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).
kubectl get nodes --show-labels | grep "disktype=ssd" # Eğer çıktı boşsa, uygun node yok!
kubectl label nodes <node-name> disktype=ssd region=us-east
kubectl edit deployment my-app # nodeSelector kısmını silin veya düzenleyin # Sonra kaydedin (:wq)
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.
Bazen pod pending değil "ImagePullBackOff" durumundadır ama bu da schedule sorununa yol açabilir (this can also lead to scheduling issues).
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
# Ö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.
Nadiren scheduler'ın kendisi sorunlu olabilir (rarely the scheduler itself can be problematic). Kontrol edelim:
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!
kubectl logs -n kube-system kube-scheduler-master-1
Log'larda error mesajları arayın (search for error messages in logs).
kubectl delete pod -n kube-system kube-scheduler-master-1 # Kubernetes otomatik olarak yenisini oluşturur # (Kubernetes automatically creates a new one)
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) |
alestaweb.com üzerindeki Kubernetes monitoring rehberimizi mutlaka okuyun (definitely read our monitoring guide). Sorunları önceden tespit etmek (detecting problems in advance) çok önemli!
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).
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:
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:
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.