تخطَّ إلى المحتوى

Troubleshooting Playbook

عند حدوث خطأ، لا تحذف الموارد بسرعة. اجمع الأدلة أولا.

Terminal window
kubectl get pods -o wide
kubectl describe pod <pod>
kubectl logs <pod>
kubectl logs <pod> --previous
kubectl get events --sort-by=.lastTimestamp
kubectl describe deployment <name>
kubectl describe service <name>
الحالةأين تبحث؟
ImagePullBackOffاسم Image، tag، registry secret
CrashLoopBackOfflogs و command و environment variables
Pendingresources، node selector، taints، PVC
Running لكن لا يستقبل trafficreadinessProbe أو Service selector
Service لا يعملendpoints و labels و targetPort
Ingress لا يعملIngress controller و DNS و service backend
Terminal window
kubectl get service web
kubectl get endpoints web
kubectl get pods -l app=web --show-labels

لو Endpoints فارغة، غالبا selector لا يطابق labels الخاصة بالـ Pods.

Terminal window
kubectl run dns-test --rm -it --image=busybox:1.36 --restart=Never -- nslookup web

Lab: إصلاح Service selector

المستوى: مبتدئ الوقت: 30 دقيقة الأدوات: kubectl

الهدف: اكتشاف سبب أن Service لا يصل إلى Pods.

غيّر label في Deployment أو selector في Service عمدا حتى تصبح endpoints فارغة، ثم استخدم أوامر التشخيص لاكتشاف السبب وإصلاحه.