您好,登錄后才能下訂單哦!
[root@vms101 ~]# kubectl get pods
No resources found.
[root@vms101 ~]#
[root@vms10 job]# kubectl run nginx --image=nginx --port=80
[root@vms10 job]# kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-57867cc648-km4tx 1/1 Running 0 117s
[root@vms10 job]#
[root@vms10 job]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-57867cc648-km4tx 1/1 Running 0 4m59s 10.244.2.227 vms20.rhce.cc <none> <none>
[root@vms10 job]#
訪問測試:
[root@vms101 ~]# curl -s 10.244.2.227
[root@vms101 ~]# kubectl delete pod nginx-57867cc648-km4tx
[root@vms101 ~]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-57867cc648-vc4fj 1/1 Running 0 3m36s 10.244.3.183 vms102.baiyang.com <none> <none>
[root@vms101 ~]# curl -s 10.244.3.183
現在把副本數量擴展到2個
[root@vms10 job]# kubectl edit deployments. nginx
spec:
progressDeadlineSeconds: 600
replicas: 2
[root@vms101 ~]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-57867cc648-47wpf 1/1 Running 0 22s 10.244.4.152 vms103.baiyang.com <none> <none>
nginx-57867cc648-vc4fj 1/1 Running 0 22m 10.244.3.183 vms102.baiyang.com <none> <none>
[root@vms101 ~]#
====================================
分別修改這兩個的nginx的主頁,進行測試。
[root@vms10 job]# kubectl exec nginx-57867cc648-47wpf -it bash
root@nginx-57867cc648-wjbzz:/# cd /usr/share/nginx/html/
root@nginx-57867cc648-wjbzz:/usr/share/nginx/html# ls
50x.html index.html
root@nginx-57867cc648-wjbzz:/usr/share/nginx/html# echo 111111111111 > index.html
root@nginx-57867cc648-wjbzz:/usr/share/nginx/html# exit
exit
[root@vms10 job]# kubectl exec nginx-57867cc648-vc4fj -it bash
root@nginx-57867cc648-zb8b5:/# cd /usr/share/nginx/html/
root@nginx-57867cc648-zb8b5:/usr/share/nginx/html# echo 222222222222 > index.html
root@nginx-57867cc648-zb8b5:/usr/share/nginx/html# exit
exit
[root@vms10 job]#
[root@vms10 job]# curl -s 10.244.4.152
111111111111
[root@vms10 job]# curl -s 10.244.3.183
222222222222
[root@vms10 job]#
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。