新装的 k8s 网络 pod 无法 ping 通 svc

2021-05-28 13:29:05 +08:00
 defunct9
奇怪的问题,如果部署一个 nginx 的 svc,然后用 kubectl run curl --image=radial/busyboxplus:curl -i --tty --rm,启动一个临时 pod,在里面 ping nginx-svc 不通,但是 ping nginx-svc.default 是通的。如果换个 pod,kubectl run curl --image=busybox -i --tty --rm,在里面 ping nginx-svc 就通了。

如果换到阿里的 k8s 的 ack,起这个 busyboxplus:curl,在里面 nginx-svc 是通的,这是什么古怪问题,有人遇到过吗?
4385 次点击
所在节点    Kubernetes
32 条回复
comphilip
2021-05-28 13:33:43 +08:00
这个问题一般是底层的 CNI 插件配置错了。
swulling
2021-05-28 13:41:53 +08:00
不要用 Ping 来测试 Service,没有意义。

ping 的通 ping 不通和 Service 可用不可用没啥关系。
CaptainDK
2021-05-28 13:47:53 +08:00
几个 node ? ping 的通和 ping 不通的 pod 分别运行在哪个 node 上?
GjriFeu
2021-05-28 13:54:12 +08:00
检查一下 node 上的 cni pod 起来了没
zoharSoul
2021-05-28 14:01:38 +08:00
开 ssh,我上去看看
qinxi
2021-05-28 14:09:17 +08:00
@zoharSoul #5 哈哈哈哈 经典
zoharSoul
2021-05-28 14:21:23 +08:00
@qinxi #6 这个楼主整天这么回帖, 我终于有搞回去的机会了 /狗头
defunct9
2021-05-28 14:28:55 +08:00
@GjriFeu flannel 正常。注意是换个不同版本的 busybox pod 就可以通
defunct9
2021-05-28 14:29:48 +08:00
@CaptainDK 1 个 master,2 个 worker 。无论那个 worker 只要跑这个 radial/busyboxplus:curl 就不行。
defunct9
2021-05-28 14:31:39 +08:00
@swulling ping 是个基本测试手段. 用 curl http://nginx-svc 一样不通。curl http://nginx-svc.default 就是通的
defunct9
2021-05-28 14:33:30 +08:00
@swulling can't resolve 才去 ping 的

[ root@curl:/ ]$ curl http://my-nginx
curl: (6) Couldn't resolve host 'my-nginx'


[ root@curl:/ ]$ curl http://my-nginx.default
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
daimaosix
2021-05-28 15:44:29 +08:00
开 ssh,让我上去看看
masha
2021-05-28 16:11:11 +08:00
开 ssh,让我上去看看
masha
2021-05-28 16:12:22 +08:00
看下有问题 pod 的 /etc/resolv.conf?
masha
2021-05-28 16:13:28 +08:00
swulling
2021-05-28 16:22:10 +08:00
@defunct9 你这个 debug 顺序好奇怪,都 can't resolve 了,为啥还要 ping
defunct9
2021-05-28 16:25:01 +08:00
@swulling nslookup 和 ping 都试试啊。nslookup 和 ping 都不行。
defunct9
2021-05-28 16:27:56 +08:00
@masha 跟阿里 ack 正常的 resolv.conf 比过,一样。dns-debugging-resolution 的也试了一遍了,不行。coredns 降到 1.6.7,加上 upstream,同时打开 pods verified 和 autopath @kubernetes,也不行。
defunct9
2021-05-28 16:30:06 +08:00
@swulling 这个 debug 顺序没什么奇怪的吧,pod 都是大平板市场,普通开放的 svc 都是 cluster ip,ping 一下,然后再看服务是否正常,是正常顺序吧。
raysonx
2021-05-28 16:38:37 +08:00
kube-proxy 默认的 backend

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/779800

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX