minikube所需的镜像在拉取时,要求网络能够访问k8s.gcr.io
。而此地址属于著名的404公司,在国内是无法访问的。
新版本的minikube已经在命令行中,充分考虑到了国内用户的网络情况,并提供了相应的命令行参数。不过网上大多博客的说明没有更新,在处理镜像拉取时,会让初学者浪费大量的时间处理网络问题。
具体说明可以通过minikube start --help
命令查看,节选如下:
--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.
--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
上面的帮助说明中,已经把国内用户需要填什么都说清楚了,可以说很良心了。在国内不借助代理的情况下,minikube正确的打开方式应该是:
Linux环境:
minikube start --driver='docker' --image-mirror-country='cn' --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers'
#or bare metal
sudo minikube start --driver='none' --image-mirror-country='cn' --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers'
Windows环境:
minikube start --image-mirror-country="cn"