当前位置: 首页 > 工具软件 > 4images > 使用案例 >

minikube安装k8s问题:Unable to load cached images

吕冠宇
2023-12-01

X Unable to load cached images: loading cached images: stat /home/minikube/.minikube/cache/images/k8s.gcr.io/kube-proxy_v1.22.2: no such file or directory

[minikube@slave4 ~]$ minikube start --driver=docker
* Centos 7.9.2009 上的 minikube v1.23.2
* 根据现有的配置文件使用 docker 驱动程序
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
* Updating the running docker "minikube" container ...
! This container is having trouble accessing https://k8s.gcr.io
* To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
* 正在 Docker 20.10.8 中准备 Kubernetes v1.22.2…
X Unable to load cached images: loading cached images: stat /home/minikube/.minikube/cache/images/k8s.gcr.io/kube-proxy_v1.22.2: no such file or directory

解决方法

根据报错信息,可以看出程序无法下载所需文件:kube-proxy_v1.22.2
需要解决上面提示的那个问题:
! This container is having trouble accessing https://k8s.gcr.io
* To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
这是网络的问题,国内不允许访问 !
使用国内阿里的镜像仓库进行安装:

minikube delete  # 必需先清除缓存后再继续,否则问题不会得到解决
minikube start --image-mirror-country='cn' --driver docker --image-repository=registry.cn-hangzhou.aliyuncs.com

# 也可以如下:
minikube config set driver docker
minikube config set image-repository registry.cn-hangzhou.aliyuncs.com
minikube delete
minikube start

问题已得到解决:

[minikube@slave4 ~]$ minikube delete
* 正在删除 docker 中的“minikube”…
* 正在删除容器 "minikube" ...
* 正在移除 /home/minikube/.minikube/machines/minikube…
* Removed all traces of the "minikube" cluster.
[minikube@slave4 ~]$ 
[minikube@slave4 ~]$ 
[minikube@slave4 ~]$ minikube start --image-mirror-country='cn' --driver docker --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers
* Centos 7.9.2009 上的 minikube v1.23.2
* 根据用户配置使用 docker 驱动程序
* 正在使用镜像存储库 registry.cn-hangzhou.aliyuncs.com/google_containers
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
    > registry.cn-hangzhou.aliyun...: 12.69 MiB / 355.40 MiB  3.57% 165.72 KiB 
    > registry.cn-hangzhou.aliyun...: 0 B [____________________] ?% ? p/s 1m42s
* Creating docker container (CPUs=2, Memory=2200MB) ...\ E1022 11:59:17.053296   18973 cache.go:215] Error caching images:  Caching images for kubeadm: caching images: caching image "/home/minikube/.minikube/cache/images/registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager_v1.22.2": write: unexpected EOF    
* 正在 Docker 20.10.8 中准备 Kubernetes v1.22.2…
X Unable to load cached images: loading cached images: stat /home/minikube/.minikube/cache/images/registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver_v1.22.2: no such file or directory
^C
[minikube@slave4 ~]$ minikube start --image-mirror-country='cn' --driver docker --image-repository=registry.cn-hangzhou.aliyuncs.com
* Centos 7.9.2009 上的 minikube v1.23.2
* 根据现有的配置文件使用 docker 驱动程序
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
* Updating the running docker "minikube" container ...
* 正在 Docker 20.10.8 中准备 Kubernetes v1.22.2…
  - Generating certificates and keys ...
  - Booting up control plane ...
  - Configuring RBAC rules ...
* Verifying Kubernetes components...
  - Using image registry.cn-hangzhou.aliyuncs.com/google_containers/storage-provisioner:v5 (global image repository)
* Enabled addons: storage-provisioner, default-storageclass

! /usr/local/bin/kubectl is version 1.8.0, which may have incompatibilites with Kubernetes 1.22.2.
  - Want kubectl v1.22.2? Try 'minikube kubectl -- get pods -A'
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
[minikube@slave4 ~]$ 


可以参考:https://www.cnblogs.com/moonlight-lin/p/13128702.html

 类似资料: