安装Minikube无法访问k8s.gcr.io的简单解决办法

学习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.