Kubectl 记录返回 tls 握手超时

Kubectl logs returning tls handshake timeout

kubectl -n namespace1 logs -f podname

returns下面的错误。

Error from server: Get https://ipaddress:10250/containerLogs/namespace1/podname-xxkb9/podname?follow=true: net/http: TLS handshake timeout

未设置代理。

unset http_proxy
unset https_proxy

但是问题还是来了。 谁能帮我解决这个问题。

据我所知,这肯定不是证书问题。这是 API 版本不匹配问题或与 API 相关的其他问题。以前关于stack的讨论很少,最后附上。我几年前也有过同样的经历,当时我也通过 kubeadm upgrade

解决了这个问题

首先通过 运行 kubectl logs -v9 检查真正的错误消息以获得最大详细级别。

很可能你检查了其他命令,如 kubect get pods,nodesNone of those commands ,要求 apiserver 联系 kubelet,只有 kubectl logs 这样做。 @Kamos 问了你绝对正确的问题 exec/attach/portforward。 99% 他们也不适合你,因为他们还需要直接联系 kubelet。

您有很多机会解决 Upgrading kubeadm clusters

的问题

参考文献:

1.

2. Kubernetes logs command TLS handshake timeout ANSWER1!!!

3. Kubernetes logs command TLS handshake timeout ANSWER2

4. kubectl logs failed with error: net/http: TLS handshake timeout #71343

在没有代理的情况下重新安装 Kubernetes 解决了这个问题。