[英]Kubernetes in Docker for Desktop (Windows) is unable to connect to the server
I set up Docker for Desktop (Windows) and enabled Kubernetes in the gui.我设置了 Docker for Desktop (Windows) 并在 gui 中启用了 Kubernetes。 I am behind a Proxy and added .internal to the no_proxy environmental variable.
我在 Proxy 后面,并将 .internal 添加到 no_proxy 环境变量中。
kubectl config get-contexts shows that I am in the docker-desktop context. kubectl config get-contexts 表明我在 docker-desktop 上下文中。
kubectl config view shows the following config : kubectl 配置视图显示以下配置:
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://kubernetes.docker.internal:6443
name: docker-desktop
contexts:
- context:
cluster: docker-desktop
user: docker-desktop
name: docker-desktop
current-context: docker-desktop
kind: Config
preferences: {}
users:
- name: docker-desktop
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
Now whenever I try to run a command like kubectl cluster-info or kubectl get pod, the following Error-Message is shown:现在,每当我尝试运行 kubectl cluster-info 或 kubectl get pod 之类的命令时,都会显示以下错误消息:
Unable to connect to the server: dial tcp: lookup kubernetes.docker.internal on 160.50.250.20:53: dial udp 160.50.250.20:53: connect: network is unreachable无法连接到服务器:拨打 tcp:在 160.50.250.20:53 上查找 kubernetes.docker.internal:拨打 udp 160.50.250.20:53:连接:网络无法访问
As a solution i edited the config file which is in作为解决方案,我编辑了位于
~/.kube/config
I replaced "kubernetes.docker.internal" with "localhost"我用“localhost”替换了“kubernetes.docker.internal”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.