Kubectl和Minikube问题-无法连接到服务器 [英] Kubectl and Minikube problem - Unable to connect to the server
问题描述
它看起来像是随机发生的,但是当我打开Minikube并开始使用它时,过了一会儿(无法确切地说出它多长时间,每次都会改变),我突然无法将命令与kubectl一起使用并获取错误-
It looks like it happens randomly, but when I bring up Minikube and start working with it, after a while (can't say exactly how long, it changes every time) I suddenly can't use commands with kubectl and get an error -
无法连接到服务器:拨打tcp 192.168.1.20:8443:连接: 没有主机的途径
Unable to connect to the server: dial tcp 192.168.1.20:8443: connect: no route to host
我试图在Internet上找到一种解决方案,但是找不到发生这种情况的原因,除了用删除一个minikube之外,我无法解决它
I tried to find a solution on the Internet but couldn't find the reason why this was happening, and I can't fix it other than deleting a minikube with
sudo minikube delete
然后使用
sudo minikube start --vm-driver=none
有人遇到这个问题并且可以提供帮助吗?
Anyone come across this and can help?
推荐答案
当我的 minikube 超载时,我也有类似的行为.我当时使用默认设置旋转了一个 minikube ,但是随后在上面部署了太多的工作负载.有时我会遇到相同的错误.
I had similar behaviour when my minikube was overloaded. I was spinning up a minikube with default settings, but then deploying too much workloads on it. At some point I get the same error.
尝试使用以下方法跟踪节点上的负载:
Try tracking the load on your node with:
kubectl top nodes
或
kubectl top pods --all-namespaces
我发现以更多资源运行 minikube 对我有帮助.
I found that running minikube with more resources helped me.
我新的默认设置是:
sudo minikube start --cpu 4 --memory 8192
这篇关于Kubectl和Minikube问题-无法连接到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!