Pods
ما هو Pod؟
Section titled “ما هو Pod؟”Pod هو أصغر وحدة تشغيل في Kubernetes. غالبا يحتوي Container واحد، وأحيانا أكثر من Container لو كانوا يحتاجون العمل معا بشكل قريب.
إنشاء Pod
Section titled “إنشاء Pod”أنشئ ملف pod.yaml:
apiVersion: v1kind: Podmetadata: name: hello-pod labels: app: hellospec: containers: - name: web image: nginx:1.27 ports: - containerPort: 80طبق الملف:
kubectl apply -f pod.yamlkubectl get podsفحص Pod
Section titled “فحص Pod”kubectl describe pod hello-podkubectl logs hello-podالدخول إلى Container
Section titled “الدخول إلى Container”kubectl exec -it hello-pod -- shللخروج:
exitLab: تشغيل أول Pod
الهدف: إنشاء Pod من Nginx وفحص حالته.
نفذ الخطوات السابقة، ثم احذف Pod:
kubectl delete -f pod.yamlراقب ما يحدث:
kubectl get pods