العمل باستخدام kubectl: أداة التحكم في عنقودك
تدرّب عمليًا على kubectl، أداة سطر الأوامر لفحص كل مورد في عنقود Kubernetes وإنشائه وإدارته
العمل باستخدام kubectl: أداة التحكم في عنقودك درس مجاني في Docker & Kubernetes for Developers على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Docker & Kubernetes for Developers، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Docker & Kubernetes for Developers 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
What Is kubectl
kubectl is the official CLI that talks to the Kubernetes API server. Nearly every cluster operation, creating, reading, updating, deleting resources, goes through it.
Configuring Cluster Access
kubectl reads a kubeconfig file (default ~/.kube/config) that holds cluster endpoints, users, and credentials grouped into contexts.
kubectl config get-contexts
kubectl config use-context my-clusterListing Resources with get
kubectl get lists resources. Add -o wide for more columns or -A for all namespaces.
kubectl get pods
kubectl get pods -o wide
kubectl get nodes -AInspecting with describe
kubectl describe shows detailed, human-readable status plus an events section that is invaluable for debugging.
kubectl describe pod my-podCreating Resources
Apply a manifest file with kubectl apply -f. This is declarative: you describe the desired state and Kubernetes reconciles to it.
kubectl apply -f deployment.yamlImperative Quick Creates
For quick experiments you can create resources imperatively.
kubectl create deployment web --image=nginx
kubectl run tmp --image=busybox --restart=Never -- sleep 3600Viewing Logs
Stream container output with kubectl logs. Use -f to follow and --previous to see a crashed container.
kubectl logs my-pod -f
kubectl logs my-pod --previousExecuting Into a Pod
Open a shell inside a running container to debug interactively.
kubectl exec -it my-pod -- /bin/shEditing and Deleting
Edit live resources or remove them. Prefer editing manifests in git over edit for production.
kubectl edit deployment web
kubectl delete pod my-podNamespaces and Scoping
Most commands accept -n namespace. Set a default namespace to avoid repeating it.
kubectl get pods -n kube-system
kubectl config set-context --current --namespace=devOutput Formats
Use -o yaml or -o json to see the full object, and -o jsonpath to extract a single field.
kubectl get pod my-pod -o yaml
kubectl get pod my-pod -o jsonpath="{.status.phase}"Quick Check
Test what you have learned.
Recap
You practiced the core kubectl verbs: get, describe, apply, logs, exec, delete, plus contexts, namespaces, and output formats to control and debug your cluster.
الأسئلة الشائعة
هل درس «العمل باستخدام kubectl: أداة التحكم في عنقودك» مجاني؟
نعم — نص درس «العمل باستخدام kubectl: أداة التحكم في عنقودك» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Docker & Kubernetes for Developers، انتقل إلى CoddyKit PRO. تتضمن دورة Docker & Kubernetes for Developers 4 دروس في المجموع.
ماذا ستتعلم في «العمل باستخدام kubectl: أداة التحكم في عنقودك»؟
تدرّب عمليًا على kubectl، أداة سطر الأوامر لفحص كل مورد في عنقود Kubernetes وإنشائه وإدارته تتمرن على Docker & Kubernetes for Developers مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Docker & Kubernetes for Developers؟
لا تُشترط خبرة سابقة. Docker & Kubernetes for Developers على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «العمل باستخدام kubectl: أداة التحكم في عنقودك»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Docker & Kubernetes for Developers هذا؟
نعم. كل درس في Docker & Kubernetes for Developers يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- مقدمة إلى Kubernetes وأهميته
- بنية Kubernetes ومكوّناته
- نشر Pod الأول
- العمل باستخدام kubectl: أداة التحكم في عنقودك