k8s主节点报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?
现象:
[root@k8s-master01 ~]# kubectl get nodes The connection to the server localhost:8080 was refused - did you specify the right host or port?
原因:
网络没有搭建,搭建网络即可(细心的小伙伴会发现集群初始化时就有这个内容提示的)
[root@k8s-master01 home]# mkdir -p $HOME/.kube [root@k8s-master01 home]# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config [root@k8s-master01 home]# sudo chown $(id -u):$(id -g) $HOME/.kube/config
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步