kubectl无法连接到服务器:x509:证书由未知授权机构签名 [英] kubectl unable to connect to server: x509: certificate signed by unknown authority
问题描述
运行kubectl一台机器(Windows)时出现错误
i'm getting an error when running kubectl one one machine (windows)
k8s集群在CentOs 7 kubernetes集群1.7上运行 主人,工人
the k8s cluster is running on CentOs 7 kubernetes cluster 1.7 master, worker
这是我的.kube \ config
Here's my .kube\config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: REDACTED
server: https://10.10.12.7:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: system:node:localhost.localdomain
name: system:node:localhost.localdomain@kubernetes
current-context: system:node:localhost.localdomain@kubernetes
kind: Config
preferences: {}
users:
- name: system:node:localhost.localdomain
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
使用kubeadm和pki目录上的默认证书构建集群
the cluster is built using kubeadm with the default certificates on the pki directory
kubectl无法连接到服务器:x509:未知授权机构签名的证书
kubectl unable to connect to server: x509: certificate signed by unknown authority
推荐答案
我只是想分享一下,对不起,由于我刚刚意识到这是造成问题的原因,所以我无法提早提供此功能
I just want to share, sorry I wasn't able to provide this earlier as I just realized this is causing
所以在主节点上,我们正在运行kubectl代理
so on the master node we're running a kubectl proxy
kubectl proxy --address 0.0.0.0 --accept-hosts '.*'
我停止了此操作,瞧,错误消失了.
I stopped this and voila the error was gone.
我现在可以做
kubectl get nodes
NAME STATUS AGE VERSION
centos-k8s2 Ready 3d v1.7.5
localhost.localdomain Ready 3d v1.7.5
我希望这对那些偶然发现这种情况的人有所帮助
I hope this helps those who stumbled upon this scenario
这篇关于kubectl无法连接到服务器:x509:证书由未知授权机构签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!