阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

kubernetes国内镜像拉取

193次阅读
没有评论

共计 6227 个字符,预计需要花费 16 分钟才能阅读完成。

因国内访问不到 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. 准备脚本

[root@localhost bin]# vi pullK8s.sh

#!/bin/bash
KUBE_VERSION=v1.13.4
KUBE_PAUSE_VERSION=3.1
ETCD_VERSION=3.2.18
DNS_VERSION=1.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
    docker pull ${username}/${image}
    docker tag ${username}/${image} k8s.gcr.io/${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.18: 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.18
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/etcd-amd64:3.2.18
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.3: 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.3
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.1.3
Untagged: registry.cn-hangzhou.aliyuncs.com/google_containers/coredns@sha256:d929e48a87979279307111fd28a52272d3fac0ed1dc8f2f53a9489be45e5f2eb

3. 查看镜像

[root@localhost bin]# pwd
/usr/local/bin
[root@localhost bin]# docker images
REPOSITORY                                TAG                IMAGE ID            CREATED            SIZE
k8s.gcr.io/kube-proxy-amd64                v1.13.4            fadcc5d2b066        3 weeks ago        80.3 MB
k8s.gcr.io/kube-scheduler-amd64            v1.13.4            dd862b749309        3 weeks ago        79.6 MB
k8s.gcr.io/kube-controller-manager-amd64  v1.13.4            40a817357014        3 weeks ago        146 MB
k8s.gcr.io/kube-apiserver-amd64            v1.13.4            fc3801f0fc54        3 weeks ago        181 MB
k8s.gcr.io/coredns                        1.1.3              b3b94275d97c        10 months ago      45.6 MB
k8s.gcr.io/etcd-amd64                      3.2.18              b8df3b177be2        11 months ago      219 MB
k8s.gcr.io/pause                          3.1                da86e6ba6ca1        15 months ago      742 kB
[root@localhost bin]#

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计6227字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中