【发布时间】:2018-10-21 12:02:24
【问题描述】:
操作系统:Mac OS 10.13.6 终端
用于远程访问的 Kubectl
当我使用“--insecure-skip-tls-verify”执行命令时,它工作正常。
dev-env at balabimac in ~/kthw
$ kubectl --insecure-skip-tls-verify --context=kubernetes-me get pods
No resources found.
dev-env at balabimac in ~/kthw
$ kubectl --insecure-skip-tls-verify --context=kubernetes-me get nodes
NAME STATUS ROLES AGE VERSION
balab29123.mylabserver.com NotReady <none> 4h v1.10.2
balab29124.mylabserver.com NotReady <none> 4h v1.10.2
dev-env at balabimac in ~/kthw
$ kubectl --insecure-skip-tls-verify --context=kubernetes-me version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.0", GitCommit:"0ed33881dc4355495f623c6f22e7dd0b7632b7c0", GitTreeState:"clean", BuildDate:"2018-09-28T15:20:58Z", GoVersion:"go1.11", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.2", GitCommit:"81753b10df112992bf51bbc2c2f85208aad78335", GitTreeState:"clean", BuildDate:"2018-04-27T09:10:24Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
但是我无法使用下面的命令访问,我卡住了。
dev-env at balabimac in ~/kthw
$ kubectl config use-context kubernetes-me
Switched to context "kubernetes-me".
dev-env at balabimac in ~/kthw
$ kubectl get pods
Unable to connect to the server: x509: certificate is valid for balab29121.mylabserver.com, balab29122.mylabserver.com, balab29126.mylabserver.com, 127.0.0.1.localhost, kubernetes.default, not localhost
dev-env at balabimac in ~/kthw
$ kubectl get nodes
Unable to connect to the server: x509: certificate is valid for balab29121.mylabserver.com, balab29122.mylabserver.com, balab29126.mylabserver.com, 127.0.0.1.localhost, kubernetes.default, not localhost
dev-env at balabimac in ~/kthw
【问题讨论】:
-
这是一个真正的 GKE 集群吗?你从哪里得到 Kube-configs 的?检查集群证书的到期日期,可能是证书已过期或您的机器不信任它们(对于自签名/本地集群设置)。除此之外,我还看到集群机器上的时间不同步的问题
-
不,它不是 GKE 集群。让我看看@andriosr
-
我正在努力关注 kubernetes,
-
酷,所以基本上你颁发的用于 apiserver 的证书不受本地机器的信任。只需将其作为受信任的证书添加到您的机器中,它就可以工作了。
-
抱歉稍后回复。我可以知道将其添加到控制器的命令吗?
标签: kubernetes google-kubernetes-engine kubernetes-health-check