【问题标题】:How to share Minikube instance on both Docker for Windows and WSL2?如何在 Docker for Windows 和 WSL2 上共享 Minikube 实例?
【发布时间】:2022-04-02 04:00:16
【问题描述】:

如何在 Windows/Windows WSL 之间共享 Minikube 实例?

在 Windows WSL 中 minikube start 失败:

????  minikube v1.22.0 on Ubuntu 20.04
✨  Using the docker driver based on existing profile
????  Starting control plane node minikube in cluster minikube
????  Pulling base image ...
????  Updating the running docker "minikube" container ...
????  StartHost failed, but will try again: provision: Temporary Error: NewSession: new client: new client: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
????  Updating the running docker "minikube" container ...
????  Failed to start docker container. Running "minikube delete" may fix it: provision: Temporary Error: NewSession: new client: new client: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

❌  Exiting due to IF_SSH_AUTH: Failed to start host: provision: Temporary Error: NewSession: new client: new client: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
????  Suggestion: Your host is failing to route packets to the minikube VM. If you have VPN software, try turning it off or configuring it so that it does not re-route traffic to the VM IP. If not, check your VM environment routing options.
????  Documentation: https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/
????  Related issue: https://github.com/kubernetes/minikube/issues/3930

以上工作在Windows:

????  minikube v1.17.1 on Microsoft Windows 10 Pro 10.0.19042 Build 19042
????  minikube 1.22.0 is available! Download it: https://github.com/kubernetes/minikube/releases/tag/v1.22.0
????  To disable this notice, run: 'minikube config set WantUpdateNotification false'

✨  Using the docker driver based on existing profile
????  Starting control plane node minikube in cluster minikube
????  Updating the running docker "minikube" container ...
????  Preparing Kubernetes v1.20.2 on Docker 20.10.2 ...
????  Verifying Kubernetes components...
????  Enabled addons: storage-provisioner, dashboard, default-storageclass
????  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

问题:

  • 为什么它会在 Linux 上失败?注意:我最初在 Windows 上安装了 Minikube。
  • 有没有办法共享 Minikube 环境?

其次,我想分享一个 Docker 上下文。 docker context ls:

窗户: 返回:

NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                             KUBERNETES ENDPOINT                 ORCHESTRATOR
default *           moby                Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine              https://127.0.0.1:53873 (default)   swarm
desktop-linux       moby                                                          npipe:////./pipe/dockerDesktopLinuxEngine

Windows WSL(Ubuntu):

docker context ls
NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                             KUBERNETES ENDPOINT                 ORCHESTRATOR
default *           moby                Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                 https://127.0.0.1:51967 (default)   swarm
desktop-linux       moby

问题:

  • 什么是默认值?
  • 什么是 desktop-linux?
  • 推荐哪一种来充分利用 WSL 的性能提升?

第三,我想分享一个 Kubernetes 上下文。 kubectl config get-contexts:

窗户:

CURRENT   NAME                                       CLUSTER          AUTHINFO                        NAMESPACE
          docker-desktop                             docker-desktop   docker-desktop
          kubernetes/REDACTED   kubernetes       REDACTED
*         minikube                                   minikube         minikube                        default

Windows WSL(Ubuntu):

CURRENT   NAME             CLUSTER          AUTHINFO         NAMESPACE
          docker-desktop   docker-desktop   docker-desktop
*         minikube         minikube         minikube

问题:

  • 什么是docker-desktop
  • 我可以安全地删除docker-desktop吗?

【问题讨论】:

标签: docker kubernetes minikube


【解决方案1】:

我能够通过复制配置文件来同步 Windows/WSL:

mkdir ~/.kube \ && cp /mnt/c/Users/[USERNAME]/.kube/config ~/.kube
kubectl config use-context docker-for-desktop # Select the Windows context
kubectl cluster-info # Check if it works## Heading ##

参考:https://devkimchi.com/2018/06/05/running-kubernetes-on-wsl/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-23
    • 2021-05-09
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 2018-12-15
    • 2016-03-13
    • 1970-01-01
    相关资源
    最近更新 更多