[root@k8s-master ~]# kubectl get nodes
E0322 10:29:10.166586 8455 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0322 10:29:10.166882 8455 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0322 10:29:10.168298 8455 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0322 10:29:10.170502 8455 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
E0322 10:29:10.172351 8455 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
The connection to the server localhost:8080 was refused - did you specify the right host or port?
单从报错可以看出,kubectl 没有使用到证书与k8s api通信,在初始化集群的时候要想使用kubectl需要,申明证书变量 export KUBECONFIG=/etc/kubernetes/admin.conf ,重启之后 KUBECONFIG 变量失效了。所有需要重新声明,并加入过/etc/profile 全局变量文件。文章来源地址https://www.toymoban.com/news/detail-859834.html
echo "export KUBECONFIG=/etc/kubernetes/kubelet.conf" >> /etc/profile
source /etc/profile
[root@k8s-master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready control-plane 15m v1.28.2
文章来源:https://www.toymoban.com/news/detail-859834.html
到了这里,关于k8s重启报错:Get “http://localhost:8080/api?timeout=32s“: dial tcp [::1]:8080: connect: connection refuse的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!