minikube安装
minikube安装
minikube官网地址:https://minikube.sigs.k8s.io/docs/start/
填坑指引
安装过程
确认系统以及对应架构
1
2
3
4
5$ uname -a # 查看系统信息
Linux crayon 5.4.0-65-generic #73~18.04.1-Ubuntu SMP Tue Jan 19 09:02:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ arch # 查看架构
x86_64选择对应的配置复制下载命令下载
minikube
安装包并安装1
2curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb启动minikube
官方注明了不要使用
root
权限启动,使用sudo
或以root
用户执行命令会报错1
2
3
4
5
6
7
8$ sudo minikube start
😄 Ubuntu 18.04 (vbox/amd64) 上的 minikube v1.26.0
✨ 自动选择 docker 驱动。其他选项:none, ssh
🛑 The "docker" driver should not be used with root privileges. If you wish to continue as root, use --force.
💡 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 start
命令,但是可能出现以下问题1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17$ minikube start
E0731 22:35:25.835507 4817 root.go:88] failed to log command start to audit: failed to open the audit log: open /home/crayon/.minikube/logs/audit.json: permission denied
E0731 22:35:25.835958 4817 cloud_events.go:60] unable to write to /home/crayon/.minikube/profiles/minikube/events.json: open /home/crayon/.minikube/profiles/minikube/events.json: permission denied
😄 Ubuntu 18.04 (vbox/amd64) 上的 minikube v1.26.0
✨ 自动选择 docker 驱动。其他选项:none, ssh
🧯 The requested memory allocation of 1987MiB does not leave room for system overhead (total system memory: 1987MiB). You may face stability issues.
💡 建议:Start minikube with less memory allocated: 'minikube start --memory=1987mb'
📌 Using Docker driver with root privileges
👍 Starting control plane node minikube in cluster minikube
🚜 Pulling base image ...
💾 Downloading Kubernetes v1.24.1 preload ...
❌ Exiting due to HOST_HOME_PERMISSION: Failed to save config: open /home/crayon/.minikube/profiles/minikube/config.json: permission denied
💡 建议:Your user lacks permissions to the minikube profile directory. Run: 'sudo chown -R $USER $HOME/.minikube; chmod -R u+wrx $HOME/.minikube' to fix
🍿 Related issue: https://github.com/kubernetes/minikube/issues/9165问题在于当前用户的权限不足导致的,原因可能是因为一开始使用了
root
用户执行了命令而以root
用户创建了相关配置文件导致的,按照命令的提示信息修改文件的权限即可解决1
2# 这里的文件路径默认是在当前用户的home目录下,需要将home目录路径改为你自己的home目录路径
$ sudo chown -R crayon /home/crayon/.minikube; chmod -R u+wrx /home/crayon/.minikube改完权限再次执行启动命令
1
2
3
4
5
6
7
8$ minikube start
😄 Ubuntu 18.04 (vbox/amd64) 上的 minikube v1.26.0
✨ 根据现有的配置文件使用 docker 驱动程序
🧯 The requested memory allocation of 1987MiB does not leave room for system overhead (total system memory: 1987MiB). You may face stability issues.
💡 建议:Start minikube with less memory allocated: 'minikube start --memory=1987mb'
👍 Starting control plane node minikube in cluster minikube启动之后会去拉去镜像,这个时候会发现镜像拉取的速度极慢
建议使用中国区镜像拉取地址
1
2
3
4
5
6
7
8
9# 先执行删除
$ minikube delete
🔥 正在删除 docker 中的“minikube”…
🔥 正在删除容器 "minikube" ...
🔥 正在移除 /home/crayon/.minikube/machines/minikube…
💀 Removed all traces of the "minikube" cluster.
# 再执行start命令
$ minikube start --image-mirror-country='cn' # 官方专门为中国用户准备的minikube start –image-mirror-country=’cn’ –extra-config=kubelet.cgroup-driver=systemd –driver=’docker’
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Crayonの博客!
评论