學習Kubenetes,安裝Minikube報錯。提示無法訪問k8s.gcr.io。
上網搜索,好像多數方法是用Docker拉取鏡像改標簽。感覺比較麻煩。
想用本地鏡像庫,運行:
minikube start --help |grep repo
--image-repository='': Alternative image repository to pull docker images from. This can be used when you have limited access to gcr.io. Set it to "auto" to let minikube decide one for you. For Chinese mainland users, you may use local gcr.io mirrors such as registry.cn-hangzhou.aliyuncs.com/google_containers
看到官方建議的解決方法是使用阿里雲服務器。
使用下面的命令就可以安裝:
sudo minikube start --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers'
補充:
發現還有一個參數,應該設置為cn。好像加了沒變化,連不上的還是連不上。
--image-mirror-country='': Country code of the image mirror to be used. Leave empty to use the global one. For Chinese mainland users, set it to cn.