WSL Ubuntu 安装 minikube

一、安装 WSL Ubuntu

1、首先 Windows Microsoft Store 安装 Ubuntu。

2、解决报错:

1、未安装 WSL 支持

WslRegisterDistribution failed with error: 0x8007019e

Installing, this may take a few minutes...
Installation Failed!
Error: 0x8007019e
Press any key to continue...

解决方案:

打开 Windows PowerShell(管理员),输入如下命令后重启:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

2、WSL 内核未升级

WslRegisterDistribution failed with error: 0x800701bc

解决方案:

下载最新 WSL 安装包,直接运行安装。

3、没有开启虚拟化

WslRegisterDistribution failed with error: 0x80370102

解决方案:

打开控制面板->程序->启用或关闭Windows功能,勾选虚拟机平台选项,确定后重启电脑。

二、安装Docker

执行如下命令即可:

1 sudo apt update
2 sudo apt upgrade
3 sudo apt install apt-transport-https ca-certificates curl software-properties-common
4 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
5 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
6 sudo apt update
7 apt-cache policy docker-ce
8 sudo apt install docker-ce
9 sudo service docker start

三、minikube 简易安装 K8S

1、安装 minikube

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube start

2、解决报错

1、没有健康的环境

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

解决方案:将当前用户添加进 Docker 组

sudo usermod -aG docker $USER && newgrp docker

2、源镜像被墙了,但有可替代源。

minikube was unable to download gcr.io/k8s-minikube/kicbase:v0.0.39, but successfully downloaded docker.io/kicbase/stable:v0.0.39 as a fallback image

解决方案:不用管

四、minikube 命令闭坑指南(官网没看仔细 :))

minikube 在使用 kubectl 时,后面需要携带 --,例如:

minikube kubectl -- create -f nginx-deployment.yaml

解决方案:

使用别名 kubectl 替代 minikube kubectl --

alias kubectl="minikube kubectl --"

五、美化 Windows 的 CMD、PowerShell 界面

Windows Microsoft Store 搜索 Windows Terminal、PowerShell 进行安装即可

六、参考文献

https://blog.csdn.net/qq_37085158/article/details/125172803

https://blog.csdn.net/weixin_51617086/article/details/125235258

https://minikube.sigs.k8s.io/docs/start/

https://zhuanlan.zhihu.com/p/559328777

https://blog.csdn.net/weixin_45574790/article/details/121419814

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章