kubernetes国内镜像拉取
因国内访问不到goole服务器,只能拉取国内的镜像,这里以阿里云为例。
安装minikube时报failed to pull image "k8s.gcr.io/kube-apiserver:v1.13.4"。
原理:先拉取阿里镜像,再改名
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.2.24
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.2.24 k8s.gcr.io/etcd:3.2.24
1.准备脚本
先设置k8s镜像源
[root@localhost yum.repos.d]# cat kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=
gpgcheck=
repo_gpgcheck=
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg [root@localhost yum.repos.d]#
yum install -y kubelet-1.14.0 kubeadm-1.14.0 kubectl-1.14.0
后查看版本依赖
[root@localhost yum.repos.d]# kubeadm config images list
I0401 ::19.728564 version.go:] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.txt": Get https://storage.googleapis.com/kubernetes-release/release/stable-1.txt: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I0401 ::19.728628 version.go:] falling back to the local client version: v1.14.0
k8s.gcr.io/kube-apiserver:v1.14.0
k8s.gcr.io/kube-controller-manager:v1.14.0
k8s.gcr.io/kube-scheduler:v1.14.0
k8s.gcr.io/kube-proxy:v1.14.0
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.3.
k8s.gcr.io/coredns:1.3.
[root@localhost yum.repos.d]#
[root@localhost bin]# vi pullK8s.sh #!/bin/bash
KUBE_VERSION=v1.14.0
KUBE_PAUSE_VERSION=3.1
ETCD_VERSION=3.3.
DNS_VERSION=1.3.
username=registry.cn-hangzhou.aliyuncs.com/google_containers images=(kube-proxy-amd64:${KUBE_VERSION}
kube-scheduler-amd64:${KUBE_VERSION}
kube-controller-manager-amd64:${KUBE_VERSION}
kube-apiserver-amd64:${KUBE_VERSION}
pause:${KUBE_PAUSE_VERSION}
etcd-amd64:${ETCD_VERSION}
coredns:${DNS_VERSION}
) for image in ${images[@]}
do
new_image=`echo $image|sed 's/-amd64//g'` ##此处需删除“-amd64”,否则kuadm还是无法识别本地镜像
docker pull ${username}/${image}
docker tag ${username}/${image} k8s.gcr.io/${new_image}
#docker tag ${username}/${image} gcr.io/google_containers/${image}
docker rmi ${username}/${image}
done
2.执行脚本
[root@localhost bin]# sh pullK8s.sh
Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy-amd64 ...
v1.13.4: Pulling from registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy-amd64
73e3e9d78c61: Already exists
0c440f353724: Pull complete
17ae2caf8e8d: Pull complete
Digest: sha256:f1623e06b9b4685ae8cf4c57ad6180a16e5e90c6ddefe8b7da9b048d64a7def2
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy-amd64:v1.13.4
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy-amd64:v1.13.4
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy-amd64@sha256:f1623e06b9b4685ae8cf4c57ad6180a16e5e90c6ddefe8b7da9b048d64a7def2
Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler-amd64 ...
v1.13.4: Pulling from registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler-amd64
73e3e9d78c61: Already exists
1a875e158006: Pull complete
Digest: sha256:c25486d95e850628afa11ae814235c70deb6e370c38970abf2e1809f67e94992
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler-amd64:v1.13.4
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler-amd64:v1.13.4
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler-amd64@sha256:c25486d95e850628afa11ae814235c70deb6e370c38970abf2e1809f67e94992
Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager-amd64 ...
v1.13.4: Pulling from registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager-amd64
73e3e9d78c61: Already exists
39e16f0f87fa: Pull complete
Digest: sha256:6d8b8cd8fac8ddc9e67e4e208df2217b9d34a9294c4ab2be61adcbe2187bd1ba
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager-amd64:v1.13.4
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager-amd64:v1.13.4
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager-amd64@sha256:6d8b8cd8fac8ddc9e67e4e208df2217b9d34a9294c4ab2be61adcbe2187bd1ba
Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver-amd64 ...
v1.13.4: Pulling from registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver-amd64
73e3e9d78c61: Already exists
758f1e738c78: Pull complete
Digest: sha256:1a263e07cd22ef294b95f8bed4e29e92e281d580803c44a9741037f1825fbf5a
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver-amd64:v1.13.4
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver-amd64:v1.13.4
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver-amd64@sha256:1a263e07cd22ef294b95f8bed4e29e92e281d580803c44a9741037f1825fbf5a
Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google_containers/pause ...
3.1: Pulling from registry.cn-hangzhou.aliyuncs.com/google_containers/pause
cf9202429979: Pull complete
Digest: sha256:759c3f0f6493093a9043cc813092290af69029699ade0e3dbe024e968fcb7cca
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.1
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.1
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/pause@sha256:759c3f0f6493093a9043cc813092290af69029699ade0e3dbe024e968fcb7cca
Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64 ...
3.2.: Pulling from registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64
032c9e83eacf: Pull complete
7b1383c20253: Pull complete
b6d57b1fcbdf: Pull complete
Digest: sha256:aee95913eeb1d4ab77d8017fd3331cbc73531227adb27918552d314c30236184
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64:3.2.
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64:3.2.
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64@sha256:aee95913eeb1d4ab77d8017fd3331cbc73531227adb27918552d314c30236184
Trying to pull repository registry.cn-hangzhou.aliyuncs.com/google_containers/coredns ...
1.1.: Pulling from registry.cn-hangzhou.aliyuncs.com/google_containers/coredns
88286f41530e: Pull complete
9e8fb813cddc: Pull complete
3ac8c130be3b: Pull complete
Digest: sha256:d929e48a87979279307111fd28a52272d3fac0ed1dc8f2f53a9489be45e5f2eb
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.1.
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.1.
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/coredns@sha256:d929e48a87979279307111fd28a52272d3fac0ed1dc8f2f53a9489be45e5f2eb
3.查看镜像
[root@localhost shell]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
k8s.gcr.io/kube-proxy v1.14.0 5cd54e388aba days ago 82.1 MB
k8s.gcr.io/kube-scheduler v1.14.0 00638a24688b days ago 81.6 MB
k8s.gcr.io/kube-controller-manager v1.14.0 b95b1efa0436 days ago MB
k8s.gcr.io/kube-apiserver v1.14.0 ecf910f40d6e days ago MB
k8s.gcr.io/coredns 1.3. eb516548c180 months ago 40.3 MB
k8s.gcr.io/etcd 3.3. 2c4adeb21b4f months ago MB
k8s.gcr.io/pause 3.1 da86e6ba6ca1 months ago kB
[root@localhost shell]#
kubernetes国内镜像拉取的更多相关文章
- docker国内镜像拉取和镜像加速registry-mirrors配置修改
docker国内镜像拉取和镜像加速registry-mirrors配置修改 学习了:http://blog.csdn.net/u014231523/article/details/61197945 站 ...
- Kubernetes Pod 镜像拉取策略
Kubernetes Pod 镜像拉取策略 官方文档:https://kubernetes.io/docs/concepts/containers/images/ • IfNotPresent:默认值 ...
- kubernetes之镜像拉取策略ImagePullSecrets;
1.容器镜像是什么? 1.容器镜像(Container Image)是最终运行的软件: 2.容器镜像(最初为Docker镜像,现在叫OCI镜像更合适)是将软件打包的形式.但是容器镜像还可以携带额外的设 ...
- Docker 配置国内镜像拉取中心,Configure docker to use faster registries in China.
Networking in China is really bad when it comes to using some cloud based tools like docker, it's us ...
- kubernetes实战篇之为默认账户创建镜像拉取密钥
系列目录 上一节我们分别使用纯文本账户密码和docker的config文件一创建一个kubernetes secret对象,并且把它添加到containers的imagePullSecrets字段用以 ...
- kubernetes之pod生命周期,pod重启策略, 镜像拉取策略
pod声明周期(状态):pending , running, succeeded, failed, unknown 挂起(Pending):Pod 已被 Kubernetes 系统接受,但有一个或者多 ...
- K8s 从懵圈到熟练 – 镜像拉取这件小事
作者 | 声东 阿里云售后技术专家 导读:相比 K8s 集群的其他功能,私有镜像的自动拉取,看起来可能是比较简单的.而镜像拉取失败,大多数情况下都和权限有关.所以,在处理相关问题的时候,我们往往会轻松 ...
- 如何将生产环境的服务Docker镜像拉取到本地进行调试
背景 很多时候我们在将开发环境的代码推送到GitLab上面以后,我们在测试的时候发现了问题后无法通过现有的日志输出级别来定位问题,比如我们需要看EFCore生成的SQL语句,在生产环境我们是不可能输出 ...
- kubernetes配置secret拉取私仓镜像
2017.05.10 19:48* 字数 390 阅读 5216评论 0喜欢 8 对于公司内部的项目, 我们不可能使用公有开放的镜像仓库, 一般情况可能会花钱买docker私仓服务, 或者说自己在服务 ...
随机推荐
- 机器学习笔记——t分布知识点总结
(原创文章,转载请注明地址:http://www.cnblogs.com/wangkundentisy/p/6539058.html ) 1.t分布式统计分布的一种,同卡方分布(χ2分布).F分布并称 ...
- bzoj 4811: [Ynoi2017]由乃的OJ
树链剖分,用zkw线段树维护每条链两个方向上对每一位的变换情况,由于位数较少,可以用两个unsigned long long表示 #include<cstdio> typedef unsi ...
- pyqt5.8.2没有qt Designer和assistant exe
使用python3.6 pyqt5.8 eric6 创建完新的窗体后,弹出如下的错误: 解决方法: 1.安装pyqt5-tools 下载地址: https://pypi.python.org/pypi ...
- Kubernetes1.8以后kubelet连接api-server问题
Kubernetes1.8以后版本,kubelet命令去掉--api-servers选项,参考官方kubelet 1.8 --kubeconfig string Path to a kubeconfi ...
- JS之滚动条效果2
在前面一篇说的是滚动条效果,本篇继续在前面的基础上面针对滚动条进行操作.本次要实现的效果如下:拖动滚动条左右移动时,上面的图片内容也相对外层盒子做相对移动. 下面针对要实现的效果进行分析:首先是页面基 ...
- Android Gradle插件(plugin)版本(version)与Gradle、SDK Build Tools版本关系
具体关系如下图: 比如,Android Studio 2.0发布,其中有个新功能“Instant Run”,需要Android Gradle Plugin版本2.0.0以上,那么我们项目的.gradl ...
- axublogcms1.0.6|代码审计
这周的审计任务,两天前的任务呀~拖延症呀~ 这次审计一个博客----auxblogcms1.0.6,网上也有所记载,我下面会做个总结. axublog是一款php个人博客系统,小巧强大的PHP+MyS ...
- EditPlus 3安装的配置操作
1.关闭自动保存备份设置 将保存时创建备份文件的钩去掉即可 2.设置字体样式 3.配置编译和运行 运行相当于在控制台执行命令: java -classpath classes Hello 4.设置快 ...
- tomcat简单使用(二)
这次主要说一说tomcat的目录文件和配置文件 先看一看tomcat的目录结构, bin:该目录下存放的是二进制可执行文件,如果是安装版,那么这个目录下会有两个exe文件:tomcat6.exe.to ...
- C,C#,Java:枚举类型
#include <stdio.h> main() { // 枚举默认从0开始,这里指定为1起头 , Tues, Wed, Thurs, Fri, Sat, Sun } day; scan ...