k8s-07-测试demo k8s

kubectl run nginx --image=nginx --replicas=3
[root@k8s-master ~]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE
nginx-8586cf59-c5qpw 1/1 Running 0 8m 172.17.96.2 192.168.56.12
nginx-8586cf59-lm85p 1/1 Running 0 8m 172.17.2.2 192.168.56.11
nginx-8586cf59-n58bm 1/1 Running 0 8m 172.17.96.3 192.168.56.12
[root@k8s-master ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-8586cf59-c5qpw 1/1 Running 0 8m
nginx-8586cf59-lm85p 1/1 Running 0 8m
nginx-8586cf59-n58bm 1/1 Running 0 8m
[root@k8s-master ~]#

[root@k8s-master ~]# kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.10.10.1 <none> 443/TCP 3h
[root@k8s-master ~]# kubectl expose deployment nginx --port=88 --target-port=80 --type=NodePort
service "nginx" exposed
[root@k8s-master ~]# kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.10.10.1 <none> 443/TCP 3h
nginx NodePort 10.10.10.86 <none> 88:35712/TCP 2s
[root@k8s-master ~]# kubectl get service nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx NodePort 10.10.10.86 <none> 88:35712/TCP 21s
[root@k8s-master ~]#

node节点测试
k8s-07-测试demo  k8s
k8s-07-测试demo  k8s
k8s-07-测试demo  k8s

猜你喜欢

转载自blog.51cto.com/wsxxsl/2294079
k8s
今日推荐