kubectl version 错误 The connection to the server localhost:8080 was refused

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 Vers

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值