k8s测试容器之间是否互通

[root@lab2 .kube]# kubectl get pod -o wide
NAME                     READY     STATUS    RESTARTS   AGE       IP           NODE
curl-87b54756-rbqzg      1/1       Running   1          41m       10.244.0.5   192.168.43.82
nginx-5dbb4c75cd-8jcpp   1/1       Running   0          45m       10.244.1.4   192.168.43.83
nginx-5dbb4c75cd-bz9j8   1/1       Running   0          45m       10.244.1.3   192.168.43.83
nginx-5dbb4c75cd-mbqbh   1/1       Running   0          45m       10.244.0.4   192.168.43.82


[root@lab2 .kube]# kubectl exec -it curl-87b54756-rbqzg sh
[ root@curl-87b54756-rbqzg:/ ]$ ping 192.168.43.83
PING 192.168.43.83 (192.168.43.83): 56 data bytes
64 bytes from 192.168.43.83: seq=0 ttl=63 time=7.055 ms
64 bytes from 192.168.43.83: seq=1 ttl=63 time=0.897 ms





[root@lab3 .kube]# kubectl exec -it nginx-5dbb4c75cd-bz9j8 sh
/ # ping 10.244.1.4
PING 10.244.1.4 (10.244.1.4): 56 data bytes
64 bytes from 10.244.1.4: seq=0 ttl=64 time=0.601 ms
64 bytes from 10.244.1.4: seq=1 ttl=64 time=0.102 ms
64 bytes from 10.244.1.4: seq=2 ttl=64 time=0.116 ms
^C

 

posted @ 2018-11-25 09:13  effortsing  阅读(2014)  评论(0编辑  收藏  举报