赞
踩
[root@zjucst-52668 ~]# kubectl run http --image=katacoda/docker-http-server:latest --replicas=1 -n cka
[root@zjucst-52668 ~]# 274 kubectl expose deployment http --external-ip="172.17.0.1" --port=8000 --target-port=80 -n cka
[root@zjucst-52668 ~]# ifconfig eth0:cka 172.17.0.1 up
[root@zjucst-52668 ~]# kubectl scale deployment http --replicas=3 -ncka [root@zjucst-52668 ~]# kubectl get pods -n cka NAME READY STATUS RESTARTS AGE http-989f8bcf9-gvjdf 1/1 Running 0 11s http-989f8bcf9-jk556 1/1 Running 0 32m http-989f8bcf9-p66hp 1/1 Running 0 11s [root@zjucst-52668 ~]# [root@zjucst-52668 ~]# kubectl describe svc http -ncka Name: http Namespace: cka Labels: run=http Annotations: <none> Selector: run=http Type: ClusterIP IP: 10.247.204.130 External IPs: 172.17.0.1 Port: <unset> 8000/TCP TargetPort: 80/TCP Endpoints: 172.16.0.43:80,172.16.0.44:80,172.16.0.45:80 Session Affinity: None Events: <none>
[root@zjucst-52668 ~]# kubectl get svc -ncka NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE http ClusterIP 10.247.204.130 172.17.0.1 8000/TCP 22m [root@zjucst-52668 ~]# kubectl describe svc http -ncka Name: http Namespace: cka Labels: run=http Annotations: <none> Selector: run=http Type: ClusterIP IP: 10.247.204.130 External IPs: 172.17.0.1 Port: <unset> 8000/TCP TargetPort: 80/TCP Endpoints: 172.16.0.43:80,172.16.0.44:80,172.16.0.45:80 Session Affinity: None Events: <none> [root@zjucst-52668 ~]# [root@zjucst-52668 ~]# curl 172.17.0.1:8000 <h1>This request was processed by host: http-989f8bcf9-gvjdf</h1> [root@zjucst-52668 ~]# curl 172.17.0.1:8000 <h1>This request was processed by host: http-989f8bcf9-p66hp</h1> [root@zjucst-52668 ~]# curl 172.17.0.1:8000 <h1>This request was processed by host: http-989f8bcf9-jk556</h1> [root@zjucst-52668 ~]#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。