ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
kubectl (ကျယ်ကျယ်ကြားရင် 'kube-control' or 'kube-cuttle' လို့ ဖတ်ကြပါတယ်) က Control Plane ရဲ့ API Server ကို HTTP request ပို့ပြီး cluster ကို ထိန်းချုပ်ပေးတဲ့ command line tool ပါ — resource တွေကို get/create/update/delete လုပ်လို့ရပါတယ်။ Command pattern က `kubectl <verb> <resource-type> <resource-name>` ဆိုတဲ့ ပုံစံအတိုင်း လိုက်ပါတယ် — ဥပမာ `kubectl get pods` ဆိုတာ 'pod အားလုံးကို ပြပါ' လို့ ဆိုလိုတာပါ။
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
`kubectl get nodes` နဲ့ cluster ထဲက node တွေကို list ကြည့်လို့ရပါတယ်။ `kubectl get pods` နဲ့ pod တွေကို ကြည့်လို့ရပါတယ် (ပထမတစ်ခါ run ရင် empty ဖြစ်နေမှာပါ — pod ဘာမှ create မထားသေးလို့ပါ)။ `kubectl describe <resource>` က resource တစ်ခုချင်းစီရဲ့ detail (event log, error message ပါ) ကို ပြပေးပါတယ် — debugging လုပ်တဲ့အခါ အကူအညီအများဆုံး command ပါ။
အတူတူ ကြည့်မယ်
# See cluster nodes
kubectl get nodes
# See all pods in the current namespace
kubectl get pods
# See pods with more detail (IP, node, status)
kubectl get pods -o wide
# See detailed info + events for one pod
kubectl describe pod <pod-name>
# Check kubectl can talk to your cluster
kubectl cluster-infoNAME STATUS ROLES AGE VERSION
minikube Ready control-plane 5m v1.29.0၅ မိနစ် စမ်းကြည့်
`kubectl get nodes` နဲ့ `kubectl cluster-info` ကို local cluster ပေါ်မှာ run ကြည့်ပြီး output ကို ကိုယ့်ဘာသာ ဖတ်ရှင်းကြည့်ပါ။
သတိလေးတစ်ချက်
kubectl command တွေက default ဖြင့် current context (ချိတ်ဆက်ထားတဲ့ cluster) ပေါ်မှာသာ အလုပ်လုပ်ပါတယ် — production cluster နဲ့ local cluster ကို context ရောပြီး command မှားမပို့မိအောင် `kubectl config current-context` နဲ့ အမြဲ စစ်ပါ။