michael01s-Mac:ibmcloud michael01$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:21:50Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
michael01s-Mac:ibmcloud michael01$
出现这个错误是因为没有设置Kubenetes的配置文件,当执行网命令“bx cs cluster-config cloudnativedev”后,会有一个export的设置环境变量,之后再执行kubectl version就没有错误了,例如:
michael01s-Mac:~ michael01$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.6", GitCommit:"6260bb08c46c31eea6cb538b34a9ceb3e406689c", GitTreeState:"clean", BuildDate:"2017-12-21T06:34:11Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
michael01s-Mac:~ michael01$

在尝试使用kubectl version命令时遇到了'连接到localhost:8080被拒绝'的错误。该问题通常是由于缺少Kubernetes配置文件导致的。通过执行'bx cs cluster-config cloudnativedev'命令并导出环境变量,可以成功解决此问题,使得后续的kubectl命令能够正常运行。
3475

被折叠的 条评论
为什么被折叠?



