gpt4 book ai didi

Kubernetes - Kubectl 版本命令返回错误

转载 作者:行者123 更新时间:2023-12-05 09:11:49 24 4
gpt4 key购买 nike

Mac

我只是通过以下方式安装 kubectl:https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-macos

MacBook-Air:~ admin$ kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:20:10Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"darwin/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

可能是什么问题,有什么想法吗?

最佳答案

kubectl version 打印出客户端版本和服务器版本。为了获取服务器版本,它连接到 kubernetes api 服务器。你要么没有安装集群,要么没有正确配置你的 kubectl 来与远程集群通信。所以它只打印客户端版本并为服务器版本抛出错误。

示例输出:

# kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.5", GitCommit:"2166946f41b36dea2c4626f90a77706f426cdea2", GitTreeState:"clean", BuildDate:"2019-03-25T15:26:52Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.5", GitCommit:"2166946f41b36dea2c4626f90a77706f426cdea2", GitTreeState:"clean", BuildDate:"2019-03-25T15:19:22Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}

您可以使用 kubectl version --client 只获取客户端版本。

# kubectl version --client
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.5", GitCommit:"2166946f41b36dea2c4626f90a77706f426cdea2", GitTreeState:"clean", BuildDate:"2019-03-25T15:26:52Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}

关于Kubernetes - Kubectl 版本命令返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59711949/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com