问题产生

 k8s 虚拟机重启之后,使用 kubectl get nodes 命令报出如下错误:

# kubectl get nodes
The connection to the server <master>:6443 was refused - did you specify the right host or port?

 

解决方法:

1. 编辑 /etc/profile

vim /etc/profile

2. 在里面添加:

export KUBECONFIG=/etc/kubernetes/admin.conf

3. 使生效

source /etc/profile

4. 关机重启一下

相关文章:

  • 2021-05-23
  • 2022-12-23
  • 2022-02-19
猜你喜欢
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2022-01-09
相关资源
相似解决方案