開始前必須先 login kubectl
kubectl create namespace k8s-training
# 切換 namespace
kubens k8s-training
kubectl run nginx --image=softleader/nginx-training:1.15.10 --restart=Never
Generated Resource | Flags |
---|---|
Pod | --restart=Never |
Deployment | --restart=Always |
Job | --restart=OnFailure |
Cron Job | --schedule= |
more details about generators
# 取得 Pod 資訊
kubectl get pod
# 檢視 Pod 內容
kubectl describe pod POD_NAME
# 在 Pod 中執行指令
kubectl exec POD_NAME COMMAND
# 取得 Pod 的 shell
kubectl exec -it POD_NAME sh
# 刪除 Pod
kubectl delete pod POD_NAME
- Learn about Deployment