k8s-07-測試demo k8s
阿新 • • 發佈:2018-10-06
image sed art com none root ffffff tcp extern 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
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 ~]#
[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
[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 ~]# 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
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