الحاويات والتنسيق باستخدام Kubernetes
تعلّم كيف تغلّف الحاويات الخدمات، وكيف يجدول Kubernetes هذه الخدمات ويوسّعها ويعالج أعطالها — وهي الأسس التي تجعل عمليات نشر الخدمات المصغّرة وبدون خادم قابلة للإدارة.
الحاويات والتنسيق باستخدام Kubernetes درس مجاني في API Rate Limiting & Scalability Patterns على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في API Rate Limiting & Scalability Patterns، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة API Rate Limiting & Scalability Patterns 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Why Containers
Microservices multiply the number of deployable units. Containers package each service with its dependencies into a portable, isolated image that runs the same everywhere.
Image vs. Container
An image is the immutable blueprint; a container is a running instance of it. You build an image once and run many identical containers from it.
FROM node:20-alpine
WORKDIR /app
COPY . .
RUN npm ci
CMD ["node", "server.js"]The Orchestration Problem
Running a few containers by hand is easy. Running hundreds across many machines — restarting crashes, balancing load, rolling out updates — needs an orchestrator.
Kubernetes Basics
Kubernetes schedules containers onto a cluster of machines and keeps them running. Core objects:
- Pod — one or more containers that run together
- Deployment — declares desired replicas
- Service — stable network endpoint
Declarative Desired State
You declare what you want; Kubernetes makes reality match. Ask for 3 replicas and it keeps 3 alive, restarting any that die.
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
selector:
matchLabels:
app: ordersSelf-Healing
If a node fails or a container crashes, Kubernetes reschedules the pod elsewhere automatically. The system converges back to the declared state without manual intervention.
Health Probes
Kubernetes uses probes to know container state:
- liveness — restart if it is hung
- readiness — only send traffic when ready
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5Horizontal Pod Autoscaling
The Horizontal Pod Autoscaler adds or removes pods based on metrics like CPU, letting microservices scale out under load and back in when quiet.
minReplicas: 2
maxReplicas: 20
targetCPUUtilizationPercentage: 70Rolling Updates
Deploying a new version replaces pods gradually, keeping the service available throughout. If the new version misbehaves, Kubernetes can roll back to the previous one.
How This Powers Serverless
Many serverless and Functions-as-a-Service platforms run on top of Kubernetes. Understanding pods, autoscaling, and probes demystifies what happens beneath a deployed function.
Resource Requests and Limits
Each container declares a CPU and memory request (what it needs to be scheduled) and a limit (its hard ceiling). Correct values let the scheduler pack nodes efficiently and stop one greedy pod from starving its neighbors.
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
cpu: 500m
memory: 512MiQuick Check
Test your orchestration knowledge.
Recap
You learned the container platform behind scalable services:
- Containers package services portably
- Kubernetes schedules and self-heals them
- Probes guide restarts and traffic
- Autoscaling and rolling updates keep services elastic and available
الأسئلة الشائعة
هل درس «الحاويات والتنسيق باستخدام Kubernetes» مجاني؟
نعم — نص درس «الحاويات والتنسيق باستخدام Kubernetes» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة API Rate Limiting & Scalability Patterns، انتقل إلى CoddyKit PRO. تتضمن دورة API Rate Limiting & Scalability Patterns 4 دروس في المجموع.
ماذا ستتعلم في «الحاويات والتنسيق باستخدام Kubernetes»؟
تعلّم كيف تغلّف الحاويات الخدمات، وكيف يجدول Kubernetes هذه الخدمات ويوسّعها ويعالج أعطالها — وهي الأسس التي تجعل عمليات نشر الخدمات المصغّرة وبدون خادم قابلة للإدارة. تتمرن على API Rate Limiting & Scalability Patterns مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ API Rate Limiting & Scalability Patterns؟
لا تُشترط خبرة سابقة. API Rate Limiting & Scalability Patterns على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «الحاويات والتنسيق باستخدام Kubernetes»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس API Rate Limiting & Scalability Patterns هذا؟
نعم. كل درس في API Rate Limiting & Scalability Patterns يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- التوسّع باستخدام بنية الخدمات المصغّرة
- الدوال عديمة الخوادم لواجهات API المعتمدة على الأحداث
- مفاهيم شبكة الخدمات وفوائدها
- الحاويات والتنسيق باستخدام Kubernetes