etcd 的 TLS 握手问题

etcd 的 TLS 握手问题

我们正在为 k8s 集群使用外部 etcd 集群。我们将 master 连接到这个 etcd 服务器,但收到

"tls: first record does not look like a TLS handshake"

如何修复此问题?(对于 eksctl 端,在具有相同证书的 etcd 服务器上一切正常运行)

ETCDCTL_API=3 /usr/local/bin/etcdctl member list   --endpoints=https://127.0.0.1:2379   --cacert=/etc/etcd/ca.crt   --cert=/etc/etcd/etcd-server.crt   --key=/etc/etcd/etcd-server.key
    b1fa8ebad0f4fa6, started, etcd-kube-cluster-1, https://10.105.113.*:2380, https://10.105.113.*:2379, false
    984a08591dda4911, started, etcd-kube-cluster-3, https://10.105.114.*:2380, https://10.105.114.*:2379, false
    b55b37a2544c7daa, started, etcd-kube-cluster-2, https://10.105.113.*:2380, https://10.105.113.*:2379, false

Kube-api 服务器清单已使用相同证书更新

答案1

该错误消息意味着 ETCD 服务器拒绝您的连接,因为 URL 中的证书或 CN 对于配置的证书无效。

我猜问题出在 etcd 服务器中配置的 subjectAltName 或 CN 上,您无法在 etcd-server 证书的 subjectAltName 中包含 127.0.0.1 IP。您可以执行以下两个选项中的任何一个来使其正常工作。

  1. 如果您想使用 127.0.0.1 IP 进行连接,则需要将该地址作为 subjectAltName 添加在 etcd 服务器证书中。
  2. 我假设您已经将所有 etcd 服务器 IP 添加为 subjectAltName,因此请尝试使用 etcd 服务器 IP/DNS 名称(而不是 127.0.0.1)进行连接。

谢谢,

相关内容