kubectl get svc
test-pod NodePort 10.98.13.86 <none> 3001:30001/TCP
another-pod NodePort 10.110.208.135 <none> 3000:30001/TCP
# 进入容器 test-pod
$ sudo kubectl exec -it test-pod /bin/sh
# 请求 another-pod
/ # wget 10.110.208.135:3000
Connecting to 10.110.208.135:3000 (10.110.208.135:3000)
wget: server returned error: HTTP/1.1 401
# 注:返回 401 说明网络通了
# 接下来请求自己的服务
/ # wget 10.98.13.86:3001
Connecting to 10.98.13.86:3001 (10.98.13.86:3001)
# 无响应
# 不写地址写 localhost 是通的
/ # wget localhost:3001
Connecting to localhost:3001 (localhost:3001)
wget: server returned error: HTTP/1.1 401
十分费解,路由应该是没有问题的。
来 V 站求助