我正在尝试使用 kubectl exec 进入我的容器之一,但我遇到了这个错误。
$ kubectl exec -it ubuntu -- bash
error: Unable to upgrade connection: {
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "x509: cannot validate certificate for <worker_node_ip> because it doesn't contain any IP SANs",
"code": 500
}
我已经根据本指南使用我的 CA 证书和管理 key 等配置了 kubectl https://coreos.com/kubernetes/docs/1.0.6/configure-kubectl.html
更新
我在 API 服务器的日志中也发现了同样的错误
E1125 17:33:16.308389 1 errors.go:62] apiserver received an error that is not an unversioned.Status: x509: cannot validate certificate for <worker_node_ip> because it doesn't contain any IP SANs
这是否意味着我在工作节点/主节点或本地计算机上的 kubectl 上错误地配置了证书?
最佳答案
如果您使用此命令创建证书:
openssl x509 -req -days 365 -in server.csr -CA ca.pem -CAkey ca-key.pem \
-CAcreateserial -out server-cert.pem
然后您的问题可以通过执行以下操作来解决,因为“客户端”证书使用 -extfile extfile.cnf:
echo subjectAltName = IP:worker_node_ip > extfile.cnf
openssl x509 -req -days 365 -in server.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial \
-out server-cert.pem -extfile extfile.cnf
您可以指定任意数量的 IP 地址,例如 IP:127.0.0.1、IP:127.0.1.1(也可以是非本地主机)。
关于ssl - kubectl exec 失败 "cannot validate certificate because it doesn' t 包含任何 IP SAN”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33906984/