The connection to the server localhost:8080 was refused - did you specify the right host or port?
問(wèn)題背景
使用 kubeadm
安裝完成 kubetnetes
之后,將節(jié)點(diǎn)加入 master
之后,提示 The connection to the server localhost:8080 was refused - did you specify the right host or port?
[root@master ~]# kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
問(wèn)題解決
方法1
查看 /etc/kubernetes/
目錄下是否存在 kubelet.conf
或者 admin.conf
(個(gè)人理解只是文件名稱不同),然后將上述兩個(gè)文件路徑寫入到 /etc/profile
環(huán)境變量配置文件中
echo "/etc/kubernetes/admin.conf" >> /etc/profile
或者
echo "/etc/kubernetes/kubelet.conf" >> /etc/profile
source /etc/profile
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master NotReady control-plane,master 5m56s v1.23.0
node1 NotReady <none> 5m17s v1.23.0
node2 NotReady <none> 5m15s v1.23.0
方法2
拷貝k8s認(rèn)證文件
參考官網(wǎng):官網(wǎng)地址
官網(wǎng)中有對(duì)
TLS 證書錯(cuò)誤
做解答
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
# 查看節(jié)點(diǎn)信息,如果沒(méi)有拷貝認(rèn)證文件,是看不到節(jié)點(diǎn)信息的
kubectl get nodes
由于沒(méi)有配置網(wǎng)絡(luò)插件,所以這里看到節(jié)點(diǎn)信息都是 NotReady
(未就緒)的
問(wèn)題總結(jié)
安裝參考文檔:https://blog.csdn.net/D1179869625/article/details/126303213文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-516019.html
?
?
?
?
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-516019.html
到了這里,關(guān)于The connection to the server localhost:8080 was refused - did you specify the right host or port?的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!