Dcoker for mac Desktop 開始對規(guī)模較大的公司不再免費(fèi)鬼癣,colima 可以作為其替代品
https://github.com/abiosoft/colima
安裝colima時陶贼,會一并安裝qemu和lima,由于當(dāng)前colima自動安裝的qemu版本在mac m1下啟動有問題待秃,所以我們采用手動安裝qemu和lima
- 安裝qemu
推薦安裝最新版本v6.2.0版本的qemu
git clone https://gitlab.com/qemu-project/qemu.git
git checkout v6.2.0
mkdir build
cd build
../configure
make
sudo make install
安裝完成后拜秧,有qemu-system-aarch64、qemu-system-arm等文件
- 安裝lima
https://github.com/lima-vm/lima
下載lima v0.8.2二進(jìn)制文件章郁,放到對應(yīng)的目錄下
或者使用如下命令可以一鍵完成安裝
brew install jq
VERSION=$(curl -fsSL https://api.github.com/repos/lima-vm/lima/releases/latest | jq -r .tag_name)
curl -fsSL https://github.com/lima-vm/lima/releases/download/${VERSION}/lima-${VERSION:1}-$(uname -s)-$(uname -m).tar.gz | tar Cxzvm /usr/local
- 安裝colima
https://github.com/abiosoft/colima/releases/tag/v0.3.2
下載colima二進(jìn)制文件枉氮,放到bin目錄下
4.使用lima啟動虛機(jī),并安裝docker和kubernetes
colima start --with-kubernetes --cpu 2 --memory 4
問題:colima error provisioning kubernetes: error at 'downloading and installing': exit status 1
colima ssh 登錄虛機(jī)暖庄,手動安裝k8s
下載 https://github.com/k3s-io/k3s/blob/master/install.sh聊替,手動執(zhí)行,安裝成功后培廓,再去啟動colima
colima start --with-kubernetes --cpu 2 --memory 4
問題:error starting kubernetes: error at 'updating config': error fetching kubeconfig on guest: exit status 1
登錄虛機(jī)拷貝/etc/rancher/k3s/k3s.yaml 文件到mac下的.kube/config中惹悄,即可使用kubectl了,可以忽略改錯誤
- 安裝docker-client肩钠、kubectl
brew install docker kubectl
- 驗(yàn)證
# 執(zhí)行docker 不報(bào)錯
docker ps
# 執(zhí)行kubectl 能獲取到節(jié)點(diǎn)
kubectl get nodes
NAME STATUS ROLES AGE VERSION
colima Ready control-plane,master 41m v1.22.6+k3s1