ssl - kubectl exec 失败 "cannot validate certificate because it doesn' t 包含任何 IP SAN”

标签 ssl kubernetes

我正在尝试使用 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/

相关文章:

ssl - 连接到 Synology 时 Nginx Stream SSL 错误 500

java - 将 JCEKS keystore 加载到 Vert.x

ssl 证书- 从 csr 获取私钥

ssl - Heroku:同时使用 herokuapp.com 和自定义域 SSL

kubernetes - 拦截/捕获 Kubernetes 中 Pod/服务的传入流量

kubernetes - 如何配置入口以使用 https 将流量定向到 https 后端

node.js - Electron 应用程序的临时 SSL 证书

kubernetes - Kubernetes上环境变量的字符串操作

nginx - 如何使用 kubectl 删除网络策略?

kubernetes - 由于证书 mTLS 上的路径无效,Istio Sidecar 代理无法启动