解决minikube无法获取到baseimage的问题 Unable to find image ‘gcr.io/k8s-minikube/kicbase 202409

问题

Unable to find image 'gcr.io/k8s-minikube/kicbase:v0.0.44@
Unable to find image 'gcr.io/k8s-minikube/kicbase:v0.0.44@sha256:eb04641328b06c5c4a14f4348470e1046bbcf9c2cbc551486e343d3a49db557e' 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).
See 'docker run --help'.

* docker "minikube" container is missing, will recreate.
* Creating docker container (CPUs=2, Memory=1700MB) ...
* Failed to start docker container. Running "minikube delete" may fix it: recreate: creating host: create: creating: setting up container node: preparing volume for minikube container: docker run --rm --name minikube-preload-sidecar --label created_by.minikube.sigs.k8s.io=true --label name.minikube.sigs.k8s.io=minikube --entrypoint /usr/bin/test -v minikube:/var gcr.io/k8s-minikube/kicbase:v0.0.44@sha256:eb04641328b06c5c4a14f4348470e1046bbcf9c2cbc551486e343d3a49db557e -d /var/lib: exit status 125
stdout:

stderr:
Unable to find image 'gcr.io/k8s-minikube/kicbase:v0.0.44@sha256:eb04641328b06c5c4a14f4348470e1046bbcf9c2cbc551486e343d3a49db557e' 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).
See 'docker run --help'.

原因

简单说就是拉取不到镜像文件了

  1. 可能是国内网络原因,但github上很多外国人也反馈拉取不到
  2. 所以更有可能是官方的镜像除了问题

解决办法

找到可以下载的镜像替换掉,比较幸运找到了一个国内镜像仓库可以下载

docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/gcr.io/k8s-minikube/kicbase:v0.0.44
# 给本地镜像换个tag,这样可以不用调整启动参数
docker tag  swr.cn-north-4.myhuaweicloud.com/ddn-k8s/gcr.io/k8s-minikube/kicbase:v0.0.44  gcr.io/k8s-minikube/kicbase:v0.0.44


重试

先清理环境
minikube delete --all -purge
这步大家根据自己的需要选择合适参数
 minikube start --force -

本文测四时间是2024年9月1日,其他文章提到的 anjone/kicbase不知道是个啥,用了会有很多其他问题,建议大家还是找原本的镜像来替代。

方法2(推荐)

I am in China, and I encounter errors when trying to start minikube, what should I do?
After executing minikube start, minikube will try to pulling images from gcr.io or Docker Hub. However, it has been confirmed that Chinese (mainland) users may not have access to gcr.io or Docker Hub. So in China mainland, it is very likely that minikube start will fail.

For Chinese users, the reason is that China mainland government has set up GFW firewall to block any access to gcr.io or Docker Hub from China mainland.

Minikube is an open community and we are always willing to help users from any corner of the world to use our open-source software, and provide possible assistance when possible. Here are 3 possible ways to resolve the blockade.

Use minikube start --image-mirror-country='cn' instead. Aliyun (a Chinese corporation) provides a mirror repository (registry.cn-hangzhou.aliyuncs.com/google_containers) for those images, to which Chinese users have access. By using --image-mirror-country='cn' flag, minikube will try to pull the image from Aliyun mirror site as first priority.

Note: when a new image is published on gcr.io, it may take several days for the image to be synchronized to Aliyun mirror repo. However, minikube will always try to pull the newest image by default, which will cause a failure of pulling image. Under this circumstance, you HAVE TO use --kubernetes-version flag AS WELL to tell minikube to use an older version image which is available on Aliyun repo.

For example, minikube start --image-mirror-country='cn' --kubernetes-version=v1.23.8 will tell minikube to pull v1.23.8 k8s image from Aliyun.

If you have a private mirror repository provided by your own cloud provider, you can specify that via --image-repository flag. For example, using minikube start --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers' will tell minikube to try to pull images from registry.cn-hangzhou.aliyuncs.com/google_containers mirror repository as first priority.

Use a proxy server/VPN, if you have one.
Note: please obey the local laws. In some area, using an unauthorized proxy server/VPN is ILLEGAL

总接一下,minikube考虑到了伟大的墙的问题,并提供了解决方案。那就是启动的时候添加两个限定国内镜像仓库的参数,这样可以避免后面minikube拉不到镜像的问题,可谓一举多得
–image-mirror-country=‘cn’
–image-repository=‘registry.cn-hangzhou.aliyuncs.com/google_containers’

 minikube start --force   --image-mirror-country='cn'  --image-repository='registry.cn-hangzhou.aliyuncs.com/google_containers'

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值