gpt4 book ai didi

kubernetes - Kubectl无法通过I/O超时错误连接到服务器

转载 作者:行者123 更新时间:2023-12-02 12:11:02 26 4
gpt4 key购买 nike

我正在尝试解决以下问题:

kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Unable to connect to the server: dial tcp 192.168.0.10:6443: i/o timeout
我在我试图解决的一些stackoverflow帖子上找到了答案
$kubectl config view 
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://192.168.0.10:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
之后,我编写了以下命令,并在下面得到了此命令:
$ kubectl config use-context docker-for-desktop
error: no context exists with the name: "docker-for-desktop"
之后,我正在运行sudo docker ps,我在下面得到此图片:
enter image description here
我该如何解决 Unable to connect to the server错误?

最佳答案

Unable to connect to the server: dial tcp 192.168.0.10:6443: i/o timeout上面的错误意味着应该在6443进程中运行的Kubernetes API Server可能没有在kubeadm init端口上侦听。可以通过sudo docker ps | grep api检查kube API Server容器是否正在运行来验证这一点
禁用交换并重新启动计算机

sudo swapoff -a 
sudo sed -i '/ swap / s/^/#/' /etc/fstab
通过运行以下命令来卸载并重新安装kubernetes
sudo kubeadm reset -f
sudo kubeadm init
作为附带说明,如果您在本地系统上尝试kubernetes,建议您使用minikube或kind代替kubeadm。

关于kubernetes - Kubectl无法通过I/O超时错误连接到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62979553/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com