我在使用 Kubespray 引导的 1.26.5 集群上发生了一件非常奇怪的事情(一个主节点,仅一个节点)。 该集群也使用 CoreDNS 和 Kubespray 自动设置的 nodelocaldns。
我看到的第一件事是我的一个证书不是用 cert-manager 自动生成的。
起初我以为这是hairpin nat,但是运行了一些测试就放弃了这个理论。
我继续使用可抛出的 pod 运行一些查询,我得到了这个(我用假域名和真实 IP 替换了真实域名和真实 IP):
❯ kubectl run --rm -it busybox-2 --image=arunvelsriram/utils:latest
If you don't see a command prompt, try pressing enter.
utils@busybox-2:~$ nslookup admin-test-info.my.domain.com
Server: 169.254.25.10
Address: 169.254.25.10#53
Non-authoritative answer:
admin-test-info.my.domain.com canonical name = my.domain.com.
Name: my.domain.com
Address: 50.50.50.50
utils@busybox-2:~$ curl -v http://admin-test-info.my.domain.com
* Rebuilt URL to: http://admin-test-info.my.domain.com/
^C
这个curl请求挂在那里,没有来自DNS服务器的答复。 然后我继续直接在规范名称上尝试卷曲请求,我得到了这个:
utils@busybox-2:~$ nslookup my.domain.com
Server: 169.254.25.10
Address: 169.254.25.10#53
Non-authoritative answer:
Name: my.domain.com
Address: 50.50.50.50
utils@busybox-2:~$ curl -v http://my.domain.com
* Rebuilt URL to: http://my.domain.com/
* Trying 50.50.50.50...
* TCP_NODELAY set
* Connected to my.domain.com (50.50.50.50) port 80 (#0)
> GET / HTTP/1.1
> Host: my.domain.com
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Mon, 04 Dec 2023 15:26:45 GMT
< Content-Length: 19
<
404 page not found
* Connection #0 to host my.domain.com left intact
404 在这里是正常的,因为这个特定主机没有入口路由。
我已经修改了nodelocaldns配置,使域
admin-test-info.my.domain.com
看起来像一个指向本地IP的A
条目,并且我解决了我的问题,但我仍然需要了解这里发生了什么。有什么线索吗?
可能是 DNS 配置或网络设置导致了问题。您可以尝试此故障排除步骤来缩小可能导致问题的原因”
再次检查 /etc/resolv.conf/ 文件中的 DNS 配置是否正确。
确保您的网络设置(例如IP地址和掩码)正确。
检查您的日志,尤其是那些带有警告或与
相关的日志admin-test-info.my.domain.com
您可以尝试在不同的节点上部署另一个pod来检查问题是否仍然存在。