0
点赞
收藏
分享

微信扫一扫

【计算机毕设项目】2025级计算机专业项目推荐 (前后端Web项目)

皮皮球场 2024-08-14 阅读 8
香港服务器 centos7.6  2核4G 30M
搞个k8s单机部署搞了好几天 就是一直出错 遇到了好多次镜像的错误 真的是日了🐕了

索性 搞个香港服务器,不折腾镜像源了
Deploy Kubernetes On-Premises Using CentOS 7 — Part 1
https://medium.com/@sartak812/deploy-kubernetes-on-premises-using-centos-7-part1-4c61691b5520

Deploy Kubernetes On-Premises Using CentOS 7 — Part 2
https://medium.com/@sartak812/deploy-kubernetes-on-premises-using-centos-7-part-2-9f6a8f46826b
kubernetes.repo 这个文件,需要去官网下载最新的
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
# This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/repodata/repomd.xml.key
exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
EOF
[root@kube-master ~]# kubectl get nodes

E0813 00:09:15.710990    6600 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused

原因 KUBECONFIG这个变量没了
解决方法:
export KUBECONFIG=/etc/kubernetes/admin.conf

长期解决方法:暂无
This error primarily happens due to Kubeconfig file not present in the users $HOME/.kube/config location.
把admin.conf 复制到这个目录下

参考:

https://discuss.kubernetes.io/t/couldnt-get-current-server-api-group-list-get-http-localhost-8080-api-timeout-32s-dial-tcp-127-0-0-1-connect-connection-refused/25471/4
$ echo $KUBECONFIG
empty

$ kubectl get pods
E1002 10:16:21.854341  105845 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

$ KUBECONFIG=$HOME/.kube/config/admin.conf

$ kubectl get pods
No resources found in default namespace.
举报

相关推荐

0 条评论