Troubleshooting Playbook
لا تبدأ بالحذف
Section titled “لا تبدأ بالحذف”عند حدوث خطأ، لا تحذف الموارد بسرعة. اجمع الأدلة أولا.
ترتيب التشخيص
Section titled “ترتيب التشخيص”kubectl get pods -o widekubectl describe pod <pod>kubectl logs <pod>kubectl logs <pod> --previouskubectl get events --sort-by=.lastTimestampkubectl describe deployment <name>kubectl describe service <name>أشهر الحالات
Section titled “أشهر الحالات”| الحالة | أين تبحث؟ |
|---|---|
ImagePullBackOff | اسم Image، tag، registry secret |
CrashLoopBackOff | logs و command و environment variables |
Pending | resources، node selector، taints، PVC |
Running لكن لا يستقبل traffic | readinessProbe أو Service selector |
| Service لا يعمل | endpoints و labels و targetPort |
| Ingress لا يعمل | Ingress controller و DNS و service backend |
فحص Service
Section titled “فحص Service”kubectl get service webkubectl get endpoints webkubectl get pods -l app=web --show-labelsلو Endpoints فارغة، غالبا selector لا يطابق labels الخاصة بالـ Pods.
فحص DNS
Section titled “فحص DNS”kubectl run dns-test --rm -it --image=busybox:1.36 --restart=Never -- nslookup webLab: إصلاح Service selector
الهدف: اكتشاف سبب أن Service لا يصل إلى Pods.
غيّر label في Deployment أو selector في Service عمدا حتى تصبح endpoints فارغة، ثم استخدم أوامر التشخيص لاكتشاف السبب وإصلاحه.