فحوصات الصحة: اختبارات الحيوية والجاهزية وبدء التشغيل
استخدم اختبارات Kubernetes لاكتشاف الحاويات غير السليمة، وحجب حركة المرور حتى تصبح التطبيقات جاهزة، ومنح التطبيقات البطيئة وقتًا لبدء التشغيل
فحوصات الصحة: اختبارات الحيوية والجاهزية وبدء التشغيل درس مجاني في Docker & Kubernetes for Developers على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Docker & Kubernetes for Developers، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Docker & Kubernetes for Developers 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Why Probes Matter
Kubernetes cannot know your app is healthy just because the process is running. Probes let you tell the kubelet how to check real application health.
The Three Probe Types
There are three: liveness (restart if broken), readiness (gate traffic), and startup (protect slow boots).
Liveness Probe
If the liveness probe fails, the kubelet restarts the container. Use it to recover from deadlocks the process cannot detect itself.
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 10
periodSeconds: 10Readiness Probe
If readiness fails, the Pod is removed from Service endpoints but NOT restarted. This stops traffic to a Pod that is temporarily unable to serve.
readinessProbe:
httpGet:
path: /ready
port: 8080
periodSeconds: 5Liveness vs Readiness
Liveness answers should I restart this; readiness answers should I send traffic. Using readiness as liveness causes needless restarts; the opposite causes failed requests.
Startup Probe
A startup probe disables liveness and readiness until the app finishes booting, perfect for slow-starting legacy apps.
startupProbe:
httpGet:
path: /healthz
port: 8080
failureThreshold: 30
periodSeconds: 10Probe Mechanisms
Probes can use httpGet, a raw tcpSocket connection, or run a command with exec, succeeding when the command exits 0.
livenessProbe:
exec:
command: ["cat", "/tmp/healthy"]Tuning Timing
Key knobs: initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, and successThreshold let you balance speed of detection against false positives.
Probes and Rollouts
Readiness probes make rolling updates safe: new Pods only receive traffic once ready, so a broken release does not serve users.
Debugging Failing Probes
Probe failures show up in events. Describe the Pod to see why it restarts or never becomes ready.
kubectl describe pod my-podCommon Mistakes
Avoid heavy health endpoints that themselves cause timeouts, and avoid too-short initialDelaySeconds that restart Pods before they finish booting.
Quick Check
Test what you have learned.
Recap
You learned the three probe types: liveness restarts, readiness gates traffic, startup protects slow boots, the http/tcp/exec mechanisms, timing knobs, and how readiness keeps rollouts safe.
الأسئلة الشائعة
هل درس «فحوصات الصحة: اختبارات الحيوية والجاهزية وبدء التشغيل» مجاني؟
نعم — نص درس «فحوصات الصحة: اختبارات الحيوية والجاهزية وبدء التشغيل» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Docker & Kubernetes for Developers، انتقل إلى CoddyKit PRO. تتضمن دورة Docker & Kubernetes for Developers 4 دروس في المجموع.
ماذا ستتعلم في «فحوصات الصحة: اختبارات الحيوية والجاهزية وبدء التشغيل»؟
استخدم اختبارات Kubernetes لاكتشاف الحاويات غير السليمة، وحجب حركة المرور حتى تصبح التطبيقات جاهزة، ومنح التطبيقات البطيئة وقتًا لبدء التشغيل تتمرن على Docker & Kubernetes for Developers مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Docker & Kubernetes for Developers؟
لا تُشترط خبرة سابقة. Docker & Kubernetes for Developers على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «فحوصات الصحة: اختبارات الحيوية والجاهزية وبدء التشغيل»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Docker & Kubernetes for Developers هذا؟
نعم. كل درس في Docker & Kubernetes for Developers يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- استراتيجيات تسجيل الأحداث في Kubernetes
- المراقبة باستخدام Prometheus وGrafana
- استكشاف مشكلات K8s الشائعة وإصلاحها
- فحوصات الصحة: اختبارات الحيوية والجاهزية وبدء التشغيل