kubernetes报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?

kubernetes报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?

       今天在k8s管理平台装完一个扩展之后,后面执行kubectl相关的命令都报这个错

The connection to the server localhost:8080 was refused - did you specify the right host or port?

弄得我一脸懵逼,网上查了相关资料,后面通过运行以下命令,成功搞定,再也没报这个错

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

重新再执行kubectl相关命令,成功执行,错误信息消失。

0条评论

发表评论