mac -mac m1 安裝 k8s
mac /mac m1 安裝 k8s
以前 mac 上 k8s 一直起不來,最近升級了一下 docker for mac 的版本爲 3.2.2,對應 k8s 版本爲 1.19.7 發現 k8s 可用了
查了下官方文檔
https://docs.docker.com/docker-for-mac/apple-m1/
https://www.docker.com/blog/new-docker-desktop-preview-for-apple-m1-released/
意外發現 mac m1 也支持了,測試了一把,果然成功了,如圖
下面記錄一下安裝過程希望對大家有所幫助,卸載更新版本以後
1,先要清理舊數據
1rm -rf ~/.kuberm -rf ~/.minikuberm -rf /usr/local/bin/minikube
2rm -rf ~/Library/Group\ Containers/group.com.docker/pki
3rm -rf ~/.kube
4
2,將配置恢復到默認
3,注意恢復以後不要默認啓動 k8s,可以修改配置,只啓動 docker
1vi ~/Library/Group\ Containers/group.com.docker/settings.json
2 "kubernetesEnabled": false,
3 "showKubernetesSystemContainers": false,
4 "kubernetesInitialInstallPerformed": false,
5
4,啓動 dockerdesktop
5,由於國內網絡原因,需要設置鏡像倉庫
1git clone https://github.com/AliyunContainerService/k8s-for-docker-desktop
2cd k8s-for-docker-desktop
3git checkout v1.19.7
4
6, 從阿里源拉取鏡像
1sh load_images.sh
2
可以看到拉取了 k8s 最小系統依賴的鏡像,tag 對應的版本 v1.19.7
1 % docker images
2REPOSITORY TAG IMAGE ID CREATED SIZE
3docker/desktop-kubernetes kubernetes-v1.19.7-cni-v0.8.5-critools-v1.17.0-debian 93b3398dbfde 6 weeks ago 285MB
4k8s.gcr.io/kube-proxy v1.19.7 9d368f4517bb 2 months ago 118MB
5k8s.gcr.io/kube-apiserver v1.19.7 c15e4f843f01 2 months ago 119MB
6k8s.gcr.io/kube-scheduler v1.19.7 4fa642720eea 2 months ago 45.6MB
7k8s.gcr.io/kube-controller-manager v1.19.7 67b3bca112d1 2 months ago 111MB
8k8s.gcr.io/etcd 3.4.13-0 0369cf4303ff 6 months ago 253MB
9k8s.gcr.io/coredns 1.7.0 bfe3a36ebd25 9 months ago 45.2MB
10docker/desktop-storage-provisioner v1.1 e704287ce753 12 months ago 41.8MB
11docker/desktop-vpnkit-controller v1.0 79da37e5a3aa 12 months ago 36.6MB
12k8s.gcr.io/pause 3.2 80d28bedfe5d 13 months ago 683kB
13quay.io/kubernetes-ingress-controller/nginx-ingress-controller 0.26.1 29024c9c6e70 17 months ago 483MB
14
7,等拉取鏡像完畢後,啓動 k8s,注意需要把內存設置到 4G,等一會兒,就可以看到上面成功的頁面。
測試下我們發現 master 節點已經起來了,名字叫 docker-desktop
1 % kubectl get node
2NAME STATUS ROLES AGE VERSION
3docker-desktop Ready master 61m v1.19.7
4
看一下運行了哪些 pod
1% kubectl get pod -n kube-system
2NAME READY STATUS RESTARTS AGE
3coredns-f9fd979d6-cg26k 1/1 Running 0 65m
4coredns-f9fd979d6-dqffw 1/1 Running 0 65m
5etcd-docker-desktop 1/1 Running 0 64m
6kube-apiserver-docker-desktop 1/1 Running 0 64m
7kube-controller-manager-docker-desktop 1/1 Running 0 63m
8kube-proxy-fw6rz 1/1 Running 0 65m
9kube-scheduler-docker-desktop 1/1 Running 0 63m
10storage-provisioner 1/1 Running 0 63m
11vpnkit-controller 1/1 Running 0 63m
12
具體一點,我們可以看到都運行在我們的 master node 上
1 % kubectl get pod -n kube-system -o wide
2NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
3coredns-f9fd979d6-cg26k 1/1 Running 0 125m 10.1.0.2 docker-desktop <none> <none>
4coredns-f9fd979d6-dqffw 1/1 Running 0 125m 10.1.0.3 docker-desktop <none> <none>
5etcd-docker-desktop 1/1 Running 0 124m 192.168.65.4 docker-desktop <none> <none>
6kube-apiserver-docker-desktop 1/1 Running 0 124m 192.168.65.4 docker-desktop <none> <none>
7kube-controller-manager-docker-desktop 1/1 Running 0 124m 192.168.65.4 docker-desktop <none> <none>
8kube-proxy-fw6rz 1/1 Running 0 125m 192.168.65.4 docker-desktop <none> <none>
9kube-scheduler-docker-desktop 1/1 Running 0 124m 192.168.65.4 docker-desktop <none> <none>
10storage-provisioner 1/1 Running 0 124m 10.1.0.4 docker-desktop <none> <none>
11vpnkit-controller 1/1 Running 0 124m 10.1.0.5 docker-desktop <none> <none>
12
本文由 Readfog 進行 AMP 轉碼,版權歸原作者所有。
來源:https://mp.weixin.qq.com/s/0kOa1SXsUKoaYuCvlsli-w