*使用minikube搭建k8s,遇到的最大的問題就是拉取不到鏡像。用阿里云提供的minikube可以完美解決
詳情見如下文章,minikube地址見如下文章
https://github.com/AliyunContainerService/minikube
https://developer.aliyun.com/article/221687
通過如下命令下載minikube
#Mac OSX
curl -Lo minikube https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.17.1/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
#linux
curl -Lo minikube https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.17.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
下載好后乡话,不能直接用root賬號運(yùn)行minikube,不然會報如下錯誤:
“The "docker" driver should not be used with root privileges.”
我們需要創(chuàng)建一個普通用戶,不用賦sudo權(quán)限桅滋,需要加入到docker用戶組中即可。
useradd $user
usermod -aG $user docker
創(chuàng)建好用戶后身辨,用該用戶運(yùn)行minikube start 會拉取到必要的鏡像丐谋,除了kicbase ,然后會報如下錯誤:
Unable to find image 'gcr.io/k8s-minikube/kicbase:v0.0.18@sha256:ddd0c02d289e3a6fb4bba9a94435840666f4eb81484ff3e707b69c1c484aa45e' locally
docker: Error response from daemon: Get https://gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
解決辦法煌珊,通過anjone/kicbase鏡像包來代替 gcr.io/k8s-minikube/kicbase:v0.0.18
如果docker拉取不到該鏡像号俐,記得配置國內(nèi)鏡像源registry.cn-hangzhou.aliyuncs.com/google_containers,最后在minikube運(yùn)行命令中指定這個鏡像
docker pull anjone/kicbase
minikube start --base-image="anjone/kicbase"
最后結(jié)果: