أساسيات Kubernetes
في هذه الصفحة 8 موضوعات
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
نظرة عامة
الموضوعات
- Pods
- Deployments
- Services
- ConfigMaps
- Secrets
- الفحوصات (probes)
- التوسع التلقائي (autoscaling)
تعلّم أولًا
4 ساعة تدريب (تقدير)
مخرجات التعلم
- Explain the control plane, nodes, and the desired-state model.
- Deploy services with Deployments, Services, ConfigMaps, and Secrets.
- Configure liveness, readiness, and startup probes plus resource requests and limits for JVM services.
- Scale with the Horizontal Pod Autoscaler and perform rolling updates.
- Debug pods (
describe,logs,exec, events).
الدروس
- 01لماذا Kubernetes
- 02البنية والحالة المطلوبة (Desired state)
- 03Pods وDeployments
- 04Services وIngress
- 05ConfigMaps وSecrets
- 06الفحوصات (Probes) لخدمات JVM
- 07الطلبات والحدود والتوسع التلقائي
- 08تشخيص مشكلات الـ Pods
- 09عرض عملي: نشر Shop Platform على عنقود (cluster)
- 10عرض عملي: Pod يتعطل ويعيد التشغيل باستمرار وتشخيص سببه
المختبر والتمارين
Lab
MID-057-LAB1 · Shop on Kubernetes
Outcomes: 1–5 · Time: ~4 h Deploy all Shop services, Kafka (operator or managed), and the gateway to a cluster (kind, k3d, or managed). Use Deployments, Services, an Ingress, ConfigMaps, and Secrets. Configure startup, readiness, and liveness probes and resource requests and limits for each JVM service, and an HPA on orders. Acceptance: a rolling update under load with zero failed requests.
Exercises (assessment: debugging a broken manifest set)
| ID | Outcome | Task |
|---|---|---|
| MID-057-EX01 | 1 | Explain what happens between kubectl apply and a running pod. |
| MID-057-EX02 | 2 | Write the Deployment, Service, and ConfigMap for inventory. |
| MID-057-EX03 | 3 | Fix this probe set: liveness calls an endpoint that queries the database; no startup probe. |
| MID-057-EX04 | 3 | Set requests, limits, and JVM heap flags for a service using about 600 MB of heap. |
| MID-057-EX05 | 4 | Add an HPA to orders and a rolling update strategy with no lost capacity. |
| MID-057-EX06 | 5 | Debug the provided manifests: ImagePullBackOff, a wrong Service selector, and an OOMKilled pod. |
أظهر الحلول
- EX01 API server stores the object in etcd; a controller creates a ReplicaSet and pods; the scheduler assigns a node; the kubelet pulls the image and starts containers.
- EX02 Deployment with a pinned image and labels; Service selecting
app: inventory; ConfigMap viaenvFrom. - EX03 Liveness checks only that the process is alive (
/actuator/health/liveness); readiness may reflect dependencies; add a startup probe with a generous failure threshold. - EX04 Example: memory request and limit 1 Gi,
-XX:MaxRAMPercentage=70, CPU request 500m; verify by observing the pod under load. - EX05
HorizontalPodAutoscalerminReplicas 3, maxReplicas 10, CPU 70%;maxSurge: 1,maxUnavailable: 0. - EX06
describeshows the wrong tag or registry credentials; compare Service selector with pod labels (kubectl get endpointsis empty); OOMKilled: raise the limit or reduce heap after checking usage.
Outcome 1 is also covered by quiz Q01–Q02; the other outcomes by the lab and the debugging exercise.
الاختبار
Outcomes: O1 architecture and desired state · O2 core objects · O3 probes and resources · O4 scaling and rolling updates · O5 debugging.
اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.
الجزء العملي
Debugging exercise (MID-057-EX06) plus lab MID-057-LAB1. Pass: quiz at least 8/10, all Shop services running with probes, limits, and HPA, and a rolling update under load with zero failed requests.
أخطاء شائعة
Liveness probes that check the database; no memory limits for JVMs; latest tags.
التقييم
Debugging exercise on a broken manifest set.
الصلة بالمسار الوظيفي
Platform engineering (SRB-010) and the MID capstone.