kubernetes的svc_01
[root@vms101 ~]# kubectl get pods
No resources found.
[root@vms101 ~]#
[root@vms10 job]# kubectl run nginx --image=nginx --port=80
成都创新互联公司是专业的岳阳楼网站建设公司,岳阳楼接单;提供网站建设、成都网站设计,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行岳阳楼网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
[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
[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
[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
nginx-57867cc648-vc4fj 1/1 Running 0 22m 10.244.3.183 vms102.baiyang.com
[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]#
分享文章:kubernetes的svc_01
标题路径:http://azwzsj.com/article/ppssgc.html