Intro Kubernetes Instructions II
Intro Kubernetes Instructions II
Intro Kubernetes Instructions II
Kubernetes Instructions II
1.刪除pod -> 觀察會不會生新的pod
$ kubectl get pods -o wide
$ kubectl detele pods {NAME}
$ kubectl get pods -o wide -> 看NAME和IP是不是跟原本不同
2.設定pod的環境變數
$ kubectl run test2 –image=192.168.66.21:5000/nginx:v1 –env=”TEST=test2”
$ kubectl get pods
$ kubectl exec test2 -it –bash
$ env |grep TEST -> 檢查環境變數
3.指定pod數目
$ kubectl create deployment test3 –image=192.168.66.21:5000/nginx
$ kubectl get pods
$ kubectl create deployment test4 –image=192.168.66.21:5000/nginx –replicas=2
$ kubectl get pods
$ kubectl scale deployment test3 –replicas=3
$ kubectl get pods
4.指定label
$ kubectl run test5 –image=192.168.66.21:5000/nginx –label=”os=linux”
$ kubectl run test5 –image=192.168.66.21:5000/nginx –label=”os=windows”
$ kubectl get pods –show-labels
$ kubectl get pods -L os
$ kubectl delete pod test5
$ kubectl delete pod test6
$ kubectl get pods