Linux下搭建k8s集群时,报错:The connection to the server localhost:8080 was refused

问题描述:

 

安装flannel插件时报错

Linux下搭建k8s集群时,报错:The connection to the server localhost:8080 was refused
 

 

在没有配置config文件时,kube-apiserver默认使用的是localhost,解决方法如下:

 

普通用户执行如下操作:

[[email protected] ~]# mkdir -p $HOME/.kube
[[email protected] ~]# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[[email protected] ~]# sudo chown $(id -u):$(id -g) $HOME/.kube/config