nacos-group / nacos-k8s

This project contains a Nacos Docker image meant to facilitate the deployment of Nacos on Kubernetes using StatefulSets.
606 stars 470 forks source link

k8s-v1.25.0版本nacos-2.2.0 集群无法相互通信 pod和pod之间 Failed to resolve name #409

Open z641205699 opened 1 year ago

z641205699 commented 1 year ago

日志报错: 2023-04-25 17:37:28,081 WARN [Channel<23>: (nacos-1.nacos-headless.test-middleware.svc.cluster.local:7848)] Failed to resolve name. status=Status{code=UNAVAILABLE, description=Unable to resolve host nacos-1.nacos-headless.test-middleware.svc.cluster.local, cause=java.lang.RuntimeException: java.net.UnknownHostException: nacos-1.nacos-headless.test-middleware.svc.cluster.local at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:224) at io.grpc.internal.DnsNameResolver.doResolve(DnsNameResolver.java:283) at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:319) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: java.net.UnknownHostException: nacos-1.nacos-headless.test-middleware.svc.cluster.local at java.net.InetAddress$CachedAddresses.get(InetAddress.java:764) at java.net.InetAddress.getAllByName0(InetAddress.java:1277) at java.net.InetAddress.getAllByName(InetAddress.java:1136) at java.net.InetAddress.getAllByName(InetAddress.java:1064) at io.grpc.internal.DnsNameResolver$JdkAddressResolver.resolveAddress(DnsNameResolver.java:632) at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:220)

    我再次基础上尝试了其他命名空间的pod 不使用headless 方式是正常的

    [root@nacos-0 nacos]# ping nacos-1.nacos-headless.test-middleware.svc.cluster.local

ping: nacos-1.nacos-headless.test-middleware.svc.cluster.local: Name or service not known

z641205699 commented 1 year ago

nacos 集群是3台 有状态服务,yaml文件内容参考:官网 如果我手动pod容器内添加nacos-1.nacos-headless.test-middleware.svc.cluster.local 本机并指定IP地址 则 ping正常

Umbrallerstackcode commented 1 month ago

你好,我也遇到了这个问题,请问你解决了吗