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

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