我是靠谱客的博主 斯文咖啡,这篇文章主要介绍K8s - X - 3 The connection to the server localhost:8080 was refused - did you specif...一、kubernetes The connection to the server localhost:8080 was refused - did you specif…,现在分享给大家,希望可以做个参考。


K8s - 目录


K8s - X - 3 The connection to the server localhost:8080 was refused - did you specif...

  • 一、kubernetes The connection to the server localhost:8080 was refused - did you specif...
    • 1. 问题描述
    • 2. 解决方案
      • 2.1 设置环境变量并更新


一、kubernetes The connection to the server localhost:8080 was refused - did you specif…


1. 问题描述

执行 kubectl 时(如:kubectl get pod),提示一下问题:

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

说明:
出现这个问题的原因是 kubectl 命令需要使用 kubernetes-admin 来运行。可能是系统环境不干净导致,例如重装 k8s 前未完全清空配置等。

2. 解决方案

2.1 设置环境变量并更新

echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile

最后

以上就是斯文咖啡最近收集整理的关于K8s - X - 3 The connection to the server localhost:8080 was refused - did you specif...一、kubernetes The connection to the server localhost:8080 was refused - did you specif…的全部内容,更多相关K8s内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部