我是靠谱客的博主 斯文咖啡,最近开发中收集的这篇文章主要介绍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 - 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…所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部