作者:大瑞Y | 来源:互联网 | 2023-09-10 14:50
本文由编程笔记#小编为大家整理,主要介绍了k8s-07-测试demo k8s相关的知识,希望对你有一定的参考价值。
kubectl run nginx --image=nginx --replicas=3
[[email protected] ~]# 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
[[email protected] ~]# 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
[[email protected] ~]#
[[email protected] ~]# kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.10.10.1 443/TCP 3h
[[email protected] ~]# kubectl expose deployment nginx --port=88 --target-port=80 --type=NodePort
service "nginx" exposed
[[email protected] ~]# kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.10.10.1 443/TCP 3h
nginx NodePort 10.10.10.86 88:35712/TCP 2s
[[email protected] ~]# kubectl get service nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx NodePort 10.10.10.86 88:35712/TCP 21s
[[email protected] ~]#
node节点测试