简体   繁体   English

Docker for Desktop (Windows) 中的 Kubernetes 无法连接到服务器

[英]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.

相关问题 Docker for Desktop Kubernetes 无法连接到服务器:dial tcp [::1]:6445 - Docker for Desktop Kubernetes Unable to connect to the server: dial tcp [::1]:6445 Docker 对于 Windows CE:Kube.netes:无法连接到服务器 eof - Docker For Windows CE: Kubernetes: Unable to connect to the server eof kubectl 无法在 Ubuntu 上使用 Docker Desktop 连接到服务器 - kubectl unable to connect to the server with Docker Desktop on Ubuntu Docker 台式机无法连接 - Docker Desktop unable to connect windows docker 桌面kube.netes报错 - Error in windows docker desktop kubernetes 无法将 Docker Desktop 3.0.0 安装到 Windows Server 2019 DataCenter 上 - Unable to install Docker Desktop 3.0.0 onto Windows Server 2019 DataCenter 无法连接到部署在 docker-desktop kubernetes? 中的 API? 负载均衡器服务不工作 - Unable to connect to the API deployed in docker-desktop kubernetes?. Loadbalancer service not working 无法通过 Spring 引导将 Docker 桌面 Kubernetes(Windows)服务连接到本地 Postgres 数据库 - Can't connect Docker Desktop Kubernetes (Windows) services to local Postgres db via Spring Boot 如何让 kubernetes 在 Windows 桌面的 docker 中运行 - how to make kubernetes to run in docker for desktop in windows Kubernetes 在 Windows 10 上使用 Docker 桌面卡在“开始” - Kubernetes stuck at 'Starting' with Docker Desktop on Windows 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM