本文共 1359 字,大约阅读时间需要 4 分钟。
通过kubectl来连接其他node上的pod中的容器
[root@m ~]# kubectl get pods -o wideNAME READY STATUS RESTARTS AGE IP NODEbusybox-3674381263-90hh9 1/1 Running 0 39m 172.30.83.2 192.168.56.202[root@m ~]# kubectl get podsNAME READY STATUS RESTARTS AGEbusybox-3674381263-90hh9 1/1 Running 0 39m[root@m ~]# kubectl get nodeNAME STATUS AGE192.168.56.201 Ready 2d192.168.56.202 Ready 7d[root@m ~]# kubectl exec -it busybox-3674381263-90hh9 sh/ # ip a1: lo:mtu 65536 qdisc noqueue qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever5: eth0@if6: mtu 1450 qdisc noqueue link/ether 02:42:ac:1e:53:02 brd ff:ff:ff:ff:ff:ff inet 172.30.83.2/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::42:acff:fe1e:5302/64 scope link valid_lft forever preferred_lft forever
开始的时候不能连接,报错如下:
[root@m ~]# kubectl exec -it busybox-3674381263-90hh9 shError from server: error dialing backend: dial tcp 192.168.56.202:10250: getsockopt: connection refused
排查结果是:
转载于:https://blog.51cto.com/sgk2011/2108095