Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Svc_01 of kubernetes

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

[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

[root@vms10 job] #

Access Test:

[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

Now expand the number of copies to 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 1bat 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 ~] #

= =

Modify the homepages of the two nginx respectively and test them.

[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] #

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report