Minikube 挂载主机路径

问题描述 投票:0回答:2

我正在尝试将本地文件夹安装到 minikube 上以保存 jenkins 数据,但失败并出现以下错误。 想法是在 minikube 集群上运行 jenkins,并为其工作区提供持久数据。 下面提到了 minikube 版本和 kubernetes 版本以及错误日志。

'$ minikube mount "/home/sourabh/jenkins_data:/jenkins_data"
📁  Mounting host path /home/sourabh/jenkins_data into VM as /jenkins_data ...
    ▪ Mount type:
    ▪ User ID:      docker
    ▪ Group ID:     docker
    ▪ Version:      9p2000.L
    ▪ Message Size: 262144
    ▪ Options:      map[]
    ▪ Bind Address: 172.19.196.135:38837
🚀  Userspace file server: ufs starting

❌  Exiting due to GUEST_MOUNT_COULD_NOT_CONNECT: /bin/bash -c "sudo mount -t 9p -o dfltgid=$(grep ^docker: /etc/group | cut -d: -f3),dfltuid=$(id -u docker),msize=262144,port=38837,trans=tcp,version=9p2000.L 172.19.196.135 /jenkins_data": Process exited with status 32
stdout:

stderr:
mount: /jenkins_data: mount(2) system call failed: Connection timed out.

💡  Suggestion:

    If the host has a firewall:

    1. Allow a port through the firewall
    2. Specify "--port=<port_number>" for "minikube mount"

╭───────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                           │
│    😿  If the above advice does not help, please let us know:                             │
│    👉  https://github.com/kubernetes/minikube/issues/new/choose                           │
│                                                                                           │
│    Please run `minikube logs --file=logs.txt` and attach logs.txt to the GitHub issue.    │
│    Please also attach the following file to the GitHub issue:                             │
│    - /tmp/minikube_mount_a057c2cb7d52cb75588bb40c4af93fe409b78381_0.log                   │
│                                                                                           │
╰───────────────────────────────────────────────────────────────────────────────────────────╯

Logfile generate shown here

Binary: Built with gc go1.19.2 for linux/amd64
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I0109 16:36:07.842613    2616 out.go:296] Setting OutFile to fd 1 ...
I0109 16:36:07.842751    2616 out.go:348] isatty.IsTerminal(1) = true
I0109 16:36:07.842754    2616 out.go:309] Setting ErrFile to fd 2...
I0109 16:36:07.842757    2616 out.go:348] isatty.IsTerminal(2) = true
I0109 16:36:07.842890    2616 root.go:334] Updating PATH: /home/sourabh/.minikube/bin
W0109 16:36:07.842980    2616 root.go:311] Error reading config file at /home/sourabh/.minikube/config/config.json: open /home/sourabh/.minikube/config/config.json: no such file or directory
I0109 16:36:07.843091    2616 mustload.go:65] Loading cluster: minikube
I0109 16:36:07.843369    2616 config.go:180] Loaded profile config "minikube": Driver=docker, ContainerRuntime=docker, KubernetesVersion=v1.25.3
I0109 16:36:07.843676    2616 cli_runner.go:164] Run: docker container inspect minikube --format={{.State.Status}}
I0109 16:36:07.914497    2616 host.go:66] Checking if "minikube" exists ...
I0109 16:36:07.914672    2616 cli_runner.go:164] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "8443/tcp") 0).HostPort}}'" minikube
I0109 16:36:07.978854    2616 mount.go:141] Selecting IP for WSL. This may be incorrect...
I0109 16:36:07.983207    2616 out.go:177] 📁  Mounting host path /home/sourabh/jenkins_data into VM as /jenkins_data ...
I0109 16:36:07.987688    2616 out.go:177]     ▪ Mount type:
I0109 16:36:07.992029    2616 out.go:177]     ▪ User ID:      docker
I0109 16:36:07.996174    2616 out.go:177]     ▪ Group ID:     docker
I0109 16:36:08.000666    2616 out.go:177]     ▪ Version:      9p2000.L
I0109 16:36:08.005048    2616 out.go:177]     ▪ Message Size: 262144
I0109 16:36:08.009032    2616 out.go:177]     ▪ Options:      map[]
I0109 16:36:08.012980    2616 out.go:177]     ▪ Bind Address: 172.19.196.135:46487
I0109 16:36:08.017007    2616 out.go:177] 🚀  Userspace file server:
I0109 16:36:08.016686    2616 ssh_runner.go:195] Run: /bin/bash -c "[ "x$(findmnt -T /jenkins_data | grep /jenkins_data)" != "x" ] && sudo umount -f /jenkins_data || echo "
I0109 16:36:08.017091    2616 cli_runner.go:164] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube
I0109 16:36:08.087038    2616 sshutil.go:53] new ssh client: &{IP:127.0.0.1 Port:61875 SSHKeyPath:/home/sourabh/.minikube/machines/minikube/id_rsa Username:docker}
I0109 16:36:08.127492    2616 mount.go:168] unmount for /jenkins_data ran successfully
I0109 16:36:08.127507    2616 ssh_runner.go:195] Run: /bin/bash -c "sudo mkdir -p /jenkins_data"
I0109 16:36:08.135776    2616 ssh_runner.go:195] Run: /bin/bash -c "sudo mount -t 9p -o dfltgid=$(grep ^docker: /etc/group | cut -d: -f3),dfltuid=$(id -u docker),msize=262144,port=46487,trans=tcp,version=9p2000.L 172.19.196.135 /jenkins_data"
I0109 16:37:31.315966    2616 out.go:177] 🔥  Unmounting /jenkins_data ...
I0109 16:37:31.322056    2616 ssh_runner.go:195] Run: /bin/bash -c "[ "x$(findmnt -T /jenkins_data | grep /jenkins_data)" != "x" ] && sudo umount -f /jenkins_data || echo "
Log file created at: 2023/01/09 16:38:06
Running on machine: Sourabh_PC
Binary: Built with gc go1.19.2 for linux/amd64
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I0109 16:38:06.875663    2694 out.go:296] Setting OutFile to fd 1 ...
I0109 16:38:06.875853    2694 out.go:348] isatty.IsTerminal(1) = true


OS
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"

running minikube version 1.28
kuberneter 1.23.0`

尝试寻找其他可能的选项,但网上没有任何与此问题相关的信息。

ubuntu kubernetes minikube mount
2个回答
0
投票

我遇到了类似的问题,我认为该问题与认证错误有关。当您在 VPN、代理或企业环境或虚拟机后面工作时,您有时会使用与容器无关的认证,这意味着您将无法在容器外部进行通信。

为了解决这个问题,我会尝试将您的认证目录从本地安装到容器认证目录并运行

update-ca-certificates


0
投票

对我来说,错误是由于

ufw
防火墙

必须允许端口:

sudo ufw allow 40000

然后使用允许的端口安装

minikube mount --port=40000  /my/local/project:/my/minikube/project
© www.soinside.com 2019 - 2024. All rights reserved.