这是一个虚拟机内,为master节点,左边的窗口可以正常使用kubetl,右边就没法用,提示 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
https://blog.csdn.net/M82_A1/article/details/99671934
方法二:
不好用那个窗口是不是没有执行
export KUBECONFIG=/etc/kubernetes/admin.conf
可以将这条命令写入~/.bashrc中,然后source ~/.bashrc,这样在一个node上开多个窗口也不用每次export上述变量了。
(没有试过)
https://coding.imooc.com/learn/questiondetail/208554.html