简体   繁体   English

VSCode devcontainer 连接到 vm 上的 kubernetes 集群

[英]VSCode devcontainer connect to kubernetes cluster on vm

Ultimate Goal最终目标

From a dotnet/core/sdk devcontainer (using VSCode Remote Containers), debug a .NET Core app running in a kubernetes cluster hosted on another vm of my host machine.从 dotnet/core/sdk devcontainer(使用 VSCode 远程容器),调试在我主机的另一个虚拟机上托管的 kubernetes 集群中运行的 .NET Core 应用程序。

Current Setup当前设置

  • Docker Desktop for Windows running via Hyper-V通过 Hyper-V 运行的 Windows 版 Docker 桌面
    • default DockerNAT network adapter默认 DockerNAT 网络适配器
  • Ubuntu VM (multipass) running on same Hyper-V host在同一 Hyper-V 主机上运行的 Ubuntu VM(多通道)
    • microk8s cluster running on this ubuntu instance在这个 ubuntu 实例上运行的 microk8s 集群
    • default "Default Switch" network adapter默认“默认交换机”网络适配器

Errors错误

  • When I try to ping the ubuntu vm from a docker container by hostname, the IP is resolved properly but I get the error "Destination Host Unreachable"当我尝试通过主机名从 docker 容器 ping ubuntu vm 时,IP 已正确解析,但出现错误“目标主机无法访问”
  • When I try to curl the cluster api, I get the error "No route to host"当我尝试 curl 集群 api 时,出现错误“No route to host”

I put this problem aside for a week, and over that time the host has been rebooted multiple times, but no further modifications were made to the networking, Hyper-V setup, etc.我把这个问题搁置了一个星期,在那段时间里,主机已经重启了多次,但没有对网络、Hyper-V 设置等进行进一步的修改。

Starting the Ubuntu VM today, the IP changed from what used to be 172.?.?.?今天启动Ubuntu VM,IP从原来的172.?.?.? to 192.168.92.x .到 192.168.92.x 。 I do not know what caused this change.我不知道是什么导致了这种变化。

Now, Docker Desktop containers can ping the Ubuntu VM and curl the microk8s /api endpoint.现在,Docker 桌面容器可以ping Ubuntu VM 并卷曲 microk8s /api 端点。 Until such a time that I can reproduce the issue, I will mark this question as "solved" and reopen and try Nick's recommended solution if the issue returns.在我可以重现该问题之前,我会将这个问题标记为“已解决”并重新打开并在问题再次出现时尝试 Nick 推荐的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM