问题

我们可以使用官方提供的 minikube 安装单机版的k8s,查看文档 https://minikube.sigs.k8s.io/docs/start/,在执行 minikube start 命令时会有如下报错

[minikube@localhost docker]$ minikube start
* minikube v1.17.1 on Centos 7.9.2009
* Automatically selected the docker driver
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
E0224 05:53:36.304853   30819 cache.go:180] Error downloading kic artifacts:  failed to download kic base image or any fallback image
* Creating docker container (CPUs=2, Memory=2200MB) ...
! StartHost failed, but will try again: creating host: create: creating: setting up container node: preparing volume for minikube container: docker run --rm --entrypoint /usr/bin/test -v minikube:/var gcr.io/k8s-minikube/kicbase:v0.0.17@sha256:1cd2e039ec9d418e6380b2fa0280503a72e5b282adea674ee67882f59f4f546e -d /var/lib: exit status 125
stdout:stderr:
Unable to find image 'gcr.io/k8s-minikube/kicbase:v0.0.17@sha256:1cd2e039ec9d418e6380b2fa0280503a72e5b282adea674ee67882f59f4f546e' 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=2200MB) ...
* 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 --entrypoint /usr/bin/test -v minikube:/var gcr.io/k8s-minikube/kicbase:v0.0.17@sha256:1cd2e039ec9d418e6380b2fa0280503a72e5b282adea674ee67882f59f4f546e -d /var/lib: exit status 125
stdout:stderr:
Unable to find image 'gcr.io/k8s-minikube/kicbase:v0.0.17@sha256:1cd2e039ec9d418e6380b2fa0280503a72e5b282adea674ee67882f59f4f546e' 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'.! Startup with docker driver failed, trying with alternate driver ssh: Failed to start host: recreate: creating host: create: creating: setting up container node: preparing volume for minikube container: docker run --rm --entrypoint /usr/bin/test -v minikube:/var gcr.io/k8s-minikube/kicbase:v0.0.17@sha256:1cd2e039ec9d418e6380b2fa0280503a72e5b282adea674ee67882f59f4f546e -d /var/lib: exit status 125
stdout:stderr:
Unable to find image 'gcr.io/k8s-minikube/kicbase:v0.0.17@sha256:1cd2e039ec9d418e6380b2fa0280503a72e5b282adea674ee67882f59f4f546e' 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'.* Deleting "minikube" in docker ...
* Removing /home/minikube/.minikube/machines/minikube ...
* Removed all traces of the "minikube" cluster.
* Starting control plane node minikube in cluster minikube
E0224 05:55:29.007297   30819 cache.go:180] Error downloading kic artifacts:  failed to download kic base image or any fallback image
! StartHost failed, but will try again: config: please provide an IP address
* Failed to start ssh bare metal machine. Running "minikube delete" may fix it: config: please provide an IP addressX Exiting due to GUEST_PROVISION: Failed to start host: recreate: creating host: create: creating: setting up container node: preparing volume for minikube container: docker run --rm --entrypoint /usr/bin/test -v minikube:/var gcr.io/k8s-minikube/kicbase:v0.0.17@sha256:1cd2e039ec9d418e6380b2fa0280503a72e5b282adea674ee67882f59f4f546e -d /var/lib: exit status 125
stdout:stderr:
Unable to find image 'gcr.io/k8s-minikube/kicbase:v0.0.17@sha256:1cd2e039ec9d418e6380b2fa0280503a72e5b282adea674ee67882f59f4f546e' 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'.*
* If the above advice does not help, please let us know: - https://github.com/kubernetes/minikube/issues/new/choose

这是由于k8s使用的 docker Registry是google container register,在国内是不能访问的,所以image会拉取失败。

解决办法

经过多番查找,发现官方文档中有介绍解决办法,而且非常简单,

命令后添加镜像地区参数,即 minikube start --image-mirror-country='cn'
此时会拉取阿里的镜像仓库.

$ minikube delete --all
* Deleting "minikube" in docker ...
* Removing /home/minikube/.minikube/machines/minikube ...
* Removed all traces of the "minikube" cluster.
* Successfully deleted all profiles
[minikube@localhost docker]$ minikube start --image-mirror-country='cn'
* minikube v1.17.1 on Centos 7.9.2009
* Automatically selected the docker driver
* Using image repository registry.cn-hangzhou.aliyuncs.com/google_containers
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
* Creating docker container (CPUs=2, Memory=2200MB) ...
! This container is having trouble accessing https://registry.cn-hangzhou.aliyuncs.com/google_containers
* To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
* Preparing Kubernetes v1.20.2 on Docker 20.10.2 ...- Generating certificates and keys ...- Booting up control plane ...- Configuring RBAC rules ...
* Verifying Kubernetes components...
* Enabled addons: default-storageclass, storage-provisioner
* kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
[minikube@localhost docker]$ minikube kubectl -- get pods -A> kubectl.sha256: 64 B / 64 B [--------------------------] 100.00% ? p/s 0s> kubectl: 13.51 MiB / 38.37 MiB [--->_____] 35.22% 9.38 KiB p/s ETA 45m14s^C
[minikube@localhost docker]$ minikube kubectl -- get pods -A
* The control plane node must be running for this command- To start a cluster, run: "minikube start"

成功!

还有一种方法是找到minikute当前版本对应的镜像tag,自己通过代理手动下载,操作过于麻烦,我没有尝试,但是理论上是可行的。

教训

自己摸索+搜索网上教程花了2个多小时都没有解决,可是这个解决办法官方文档清清楚楚的写着,
如果第一时间能够翻一遍文档,问题很快就能解决。

所以,学习新框架,工具的时候,第一时间还是要全篇翻阅一下文档。免得耽误大量时间精力。

这里还要点赞 k8s的文档和阿里云,解决了中国开发人员的痛点。

minikube start命令的国内使用方法相关推荐

  1. npm的一些常用命令(在国内,建议使用cnpm,在淘宝镜像里面下载就行)

    npm的一些常用命令(在国内,npm操作可能会比较慢,建议使用cnpm,在淘宝镜像里面下载就行,用法和npm一样) cnpm安装地址,直接安装 npm install cnpm -g --regist ...

  2. Linux命令:tar命令批量解压方法总结

    tar命令批量解压方法总结 (2010-05-24 17:48:46) 转载▼ 标签: tar 批量解压 杂谈 分类: linux学习 由于linux的tar命令不支持批量解压,所以很多网友编写了好多 ...

  3. linux命令:ln 使用方法

    命令:ln 使用方法 指令名称 : ln 使用权限 : 所有使用者 使用方式 : ln [options] source dist,其中 option 的格式为 : [-bdfinsvF] [-S b ...

  4. linux查看文件隐藏字符,Linux使用cat命令显示隐藏字符的方法

    Linux系统中,使用普通的文本编辑器查看的时候,有些字符是不显示的,这就需要使用到cat命令来查看,下面小编就给大家介绍下Linux使用cat命令查看隐藏字符的方法,一起来了解下吧. 首先,我们创建 ...

  5. python调用shell命令-在Python中执行shell命令的6种方法,你都知道吗?

    原标题:在Python中执行shell命令的6种方法,你都知道吗? Python经常被称作"胶水语言",因为它能够轻易地操作其他程序,轻易地包装使用其他语言编写的库.今天我们就讲解 ...

  6. python使用教程cmd啥意思-对python中执行DOS命令的3种方法总结

    1. 使用os.system("cmd") 特点是执行的时候程序会打出cmd在Linux上执行的信息. import os os.system("ls") 2. ...

  7. python 命令行参数-Python 获得命令行参数的方法(推荐)

    本篇将介绍python中sys, getopt模块处理命令行参数 如果想对python脚本传参数,python中对应的argc, argv(c语言的命令行参数)是什么呢? 需要模块:sys 参数个数: ...

  8. python调用shell命令-python中执行shell命令的几个方法小结

    最近有个需求就是页面上执行shell命令,第一想到的就是os.system, 复制代码 代码如下: os.system('cat /proc/cpuinfo') 但是发现页面上打印的命令执行结果 0或 ...

  9. 接收到开始本地截图的命令:videoshot.exe 解决方法

    接收到开始本地截图的命令:videoshot.exe 解决方法 近几天在家闲来无事,看些电视剧,用迅雷边下边看,但是从今天起老是出现这个窗口: 以为电脑中招了 后来查了,才发现是迅雷的问题,用下面的方 ...

  10. Database之SQLSever:SQLSever数据表管理(GUI法/SQL语句命令法两种方法实现建立表、修改表,以及增、删、改、查)之详细攻略

    Database之SQLSever:SQLSever数据表管理(GUI法/SQL语句命令法两种方法实现建立表.修改表,以及增.删.改.查)之详细攻略 目录 一.两种方法建立表.修改表,插入多条数据记录 ...

最新文章

  1. TensorFlow案例实现线性回归
  2. 由浅入深C A S,小白也能与BAT面试官对线
  3. 刚刚,2020 ACM Fellow放榜!陈怡然、颜水成、周昆等12名华人当选
  4. (.DS_Store)避免多人提交代码到GitHub上起冲突
  5. 六款小巧的HTTP Server
  6. PAT ---- 1029. 旧键盘(20)
  7. mysql导入工具 行提交_使用命令行工具mysqlimport导入数据
  8. java 模拟栈底层用数组_java用数组模拟栈
  9. 利用机器学习进行金融数据风险评估
  10. Linux下将pycharm图标添加至桌面
  11. SAP FI配置步骤
  12. 【MyBatis笔记】07-MyBatis 核心配置文件
  13. 最近安装了Netscape Navigator 9.0英文版,真好用!
  14. Linux lvm分区扩容
  15. VS2010:把项目由WIN32改为x64
  16. 【BZOJ-4316】小C的独立集 仙人掌DP + 最大独立集
  17. Windows下LATEX排版论文攻略—CTeX、JabRef使用心得, 包括 IEEEtran.bst
  18. 计算机二级c语言软件是,我想考计算机二级考C语言,用哪个教材?下载哪个软件?谢谢!!!!...
  19. nyoj-264-国王的魔镜
  20. layui中导航元素的简单使用

热门文章

  1. 南阳OJ 题目97 兄弟郊游问题
  2. 地铁口多了一堆小卡片,事情并不简单?
  3. SAP FI组织结构及概念
  4. 使用moment获取本周、前n周、后n周开始结束日期以及动态计算周数
  5. 怎么大量转换图片格式为tiff
  6. 怎么把自己也拍成白雪公主?
  7. Pandas 学习笔记二
  8. matlab 彩色图片分解,MATLAB 彩色图像分割
  9. am相干解调matlab文档,AM调制与解调.doc
  10. mediatek无线网卡驱动 linux,MediaTek 高速USB网卡驱动适配