ubuntu下minikube安装

尝试在自己的笔记本搭建 Kubernetes 环境,于是用 minikube 搭建一个单节点集群,我的系统是ubuntu20.04,安装步骤可以查看官方文档:Install Minikube

安装minikube的过程中问题还比较多的,首先就是运行 minikube start 的时候,终端报出以下错误:

1
2
3
4
5
6
7
8
9
10
11
😄  minikube v1.24.0 on Ubuntu 20.04 (arm64)
👎 Unable to pick a default driver. Here is what was considered, in preference order:
▪ docker: Not healthy: "docker version --format {{.Server.Os}}-{{.Server.Version}}" exit status 1: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version": dial unix /var/run/docker.sock: connect: permission denied
▪ docker: Suggestion: Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker' <https://docs.docker.com/engine/install/linux-postinstall/>
▪ kvm2: Not installed: exec: "virsh": executable file not found in $PATH
▪ vmware: Not installed: exec: "docker-machine-driver-vmware": executable file not found in $PATH
▪ podman: Not installed: exec: "podman": executable file not found in $PATH
▪ virtualbox: Not installed: unable to find VBoxManage in $PATH

❌ Exiting due to DRV_NOT_HEALTHY: Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.

我们可以使用 --vm-driver=none 选项,完整命令如下:

1
sudo minikube start --vm-driver=none

又碰到一个新的问题就是:

1
2
3
4
5
😄  minikube v1.24.0 on Ubuntu 20.04 (arm64)
Using the none driver based on user configuration

❌ Exiting due to GUEST_MISSING_CONNTRACK: Sorry, Kubernetes 1.22.3 requires conntrack to be installed in root's path

提示的很清楚了,需要安装 conntrack:

1
sudo apt install conntrack

此外使用官方的方法来安装可能会出现网络问题,所以推荐使用阿里云的镜像:

1
sudo minikube start --vm-driver=none --registry-mirror=https://registry.docker-cn.com