【发布时间】:2021-03-31 11:16:03
【问题描述】:
我正在尝试使用 docker 驱动程序在安装了 ubuntu desktop 20.04 LTS 的 VM 中设置 minikube。
我遵循了here 的步骤,并且还考虑了与运行时安全选项有关的 docker 驱动程序的限制(报告为here)。当我尝试启动 minikube 时,我得到的错误是:无法启动主机:创建主机:创建:创建:准备 kic ssh:复制 pub 密钥。
这就是我为安装带有 minikube 的全新 VM 所做的工作。
- 安装docker
- 将我的用户添加到 docker 组,否则 minkube 启动将失败,因为 dockerd 以 root 身份运行(在 docker 术语中也称为 Rootless 模式)。
- 安装 kubectl(这不是必需的,但我选择了这个而不是 minikube 中的嵌入式 kubectl)
- 安装 minikube
当我启动 minikube 时,这就是我得到的:
ubuntuDesktop:~$ minikube start
???? minikube v1.16.0 on Ubuntu 20.04
✨ Using the docker driver based on user configuration
???? Starting control plane node minikube in cluster minikube
???? Creating docker container (CPUs=2, Memory=4500MB) ...
✋ Stopping node "minikube" ...
???? Powering off "minikube" via SSH ...
???? Deleting "minikube" in docker ...
???? StartHost failed, but will try again: creating host: create: creating: prepare kic ssh: copying pub key: docker copy /tmp/tmpf-memory-asset051825440 into minikube:/home/docker/.ssh/authorized_keys, output: lstat /tmp/tmpf-memory-asset051825440: no such file or directory
: exit status 1
???? Creating docker container (CPUs=2, Memory=4500MB) ...
???? Failed to start docker container. Running "minikube delete" may fix it: creating host: create: creating: prepare kic ssh: copying pub key: docker copy /tmp/tmpf-memory-asset544814591 into minikube:/home/docker/.ssh/authorized_keys, output: lstat /tmp/tmpf-memory-asset544814591: no such file or directory
: exit status 1
❌ Exiting due to GUEST_PROVISION: Failed to start host: creating host: create: creating: prepare kic ssh: copying pub key: docker copy /tmp/tmpf-memory-asset544814591 into minikube:/home/docker/.ssh/authorized_keys, output: lstat /tmp/tmpf-memory-asset544814591: no such file or directory
: exit status 1
???? If the above advice does not help, please let us know:
???? https://github.com/kubernetes/minikube/issues/new/choose
我怀疑该错误与 docker 驱动程序的安全设置问题有关,但这似乎就像一只追逐尾巴的狗:如果我不在 docker 中使用无根模式,我尝试使用以下方式启动 minikube sudo(这样 docker 也可以使用特权用户启动),然后我得到这个:
ubuntuDesktop:~$ sudo minikube start
[sudo] password for alberto:
???? minikube v1.16.0 on Ubuntu 20.04
✨ Automatically selected the docker driver. Other choices: virtualbox, none
???? The "docker" driver should not be used with root privileges.
???? If you are running minikube within a VM, consider using --driver=none:
???? https://minikube.sigs.k8s.io/docs/reference/drivers/none/
❌ Exiting due to DRV_AS_ROOT: The "docker" driver should not be used with root privileges.
所以,或者我遗漏了一些东西,或者 minikube 根本无法与 docker 驱动程序一起工作,我对此表示怀疑。
这是我的环境信息:
ubuntuDesktop:~$ docker version
Client:
Version: 19.03.11
API version: 1.40
Go version: go1.13.12
Git commit: dd360c7
Built: Mon Jun 8 20:23:26 2020
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 19.03.11
API version: 1.40 (minimum version 1.12)
Go version: go1.13.12
Git commit: 77e06fd
Built: Mon Jun 8 20:24:59 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit:
docker-init:
Version: 0.18.0
GitCommit: fec3683
ubuntuDesktop:~$ minikube version
minikube version: v1.16.0
commit: 9f1e482427589ff8451c4723b6ba53bb9742fbb1-dirty
如果有人在 ubuntu 20.04 上使用 minikube 并且可以共享版本和驱动程序,我将不胜感激。使用 minikube 和 docker 站点中的信息,我不知道还要检查什么才能使这项工作正常进行。
【问题讨论】:
-
您可以尝试运行
docker system prune、minikube delete,然后再运行minikube start --driver=docker吗? -
谢谢@mario...这似乎可行;至少我现在可以克服它之前卡住的点。关键可能是
docker system prune,这是我之前几次没有尝试过的唯一东西。为了让我学习,您能否详细说明已清理哪些垃圾导致 minkube 无法正常启动?...如果您将其作为答案发布,我将投票支持它,因为它解决了最初的问题。 -
好的,我将其发布为答案。至于详细解释究竟是什么阻止了您的 minikube 实例启动,我担心这是不可能的,因为它在每种情况下都可能是不同的事情,并且一旦它已经清理完毕无法再调试具体原因了。但让我更新我的答案,并至少提供一个一般性的解释。
-
检查 docker 日志我看到了这个:
[ERROR] Failed to start minikube scheduled stop.... 但是kubectl get all -A正在显示所有内容并正在运行...我会深入研究它,但一切似乎都在工作。跨度> -
您是否在 docker logs 中验证了此条目的确切日期和时间?我只是想知道它是否与之前不成功的 Minikube 容器配置无关。
标签: docker kubernetes minikube