由于一些原因,在国内无法访问gcr.io上的镜像,在安装kubernetes时,很多官方镜像又是都存在gcr.io上,在国内的一些教程中大都使用阿里云的镜像,但是由于阿里云镜像地址更换等原因,当按照文档使用阿里云镜像时可能已经变得不可用.下面结合实际经验,列举出几种常用的办法来解决这个问题

使用阿里云镜像地址

  • 地址1registry.aliyuncs.com/google_containers
  • 地址2registry.cn-hangzhou.aliyuncs.com/google_containers

使用dockerhub下的mirrorgooglecontainers

这个域名下同步了很多谷歌镜像,比如说要下载kube-proxy-amd64:v1.11.3这个镜像,可以使用docker pull mirrorgooglecontainers/kube-proxy-amd64:v1.11.3来进行下载,下载以后对镜像重新打标签:

docker tag docker.io/mirrorgooglecontainers/kube-proxy-amd64:v1.11.3 k8s.gcr.io/kube-proxy-amd64:v1.11.3

使用国内作者制作的gcr.io镜像安装工具

项目地址: https://github.com/zhangguanzhang/gcr.io

查询namespace

[centos@k8s-master tekton]$ curl -s https://zhangguanzhang.github.io/bash/pull.sh | bash -s search gcr.io
cloud-builders
cloud-datalab
cloudsql-docker
distroless
google-appengine
google-samples
google_containers
google_samples
heptio-images
istio-release
k8s-minikube
kaniko-project
knative-releases
knative-samples
kubeflow-images-public
kubernetes-e2e-test-images
kubernetes-helm
linkerd-io
runconduit
spinnaker-marketplace
tf-on-k8s-dogfood

查询某一名称空间下镜像列表

[centos@k8s-master tekton]$ curl -s https://zhangguanzhang.github.io/bash/pull.sh | bash -s search gcr.io/google_containers
addon-builder
addon-resizer-amd64
addon-resizer-arm
addon-resizer-arm64
addon-resizer-ppc64le
addon-resizer-s390x
addon-resizer
aggregator
alpine-iptables-amd64
alpine-iptables-arm
alpine-iptables-arm64
alpine-with-bash
apparmor-loader
busybox
cadvisor
cassandra-e2e-test
cassandra
check-metadata-concealment
cloud-controller-manager-amd64
cloud-controller-manager-arm
cloud-controller-manager-arm64
cloud-controller-manager-ppc64le
cloud-controller-manager-s390x
cloud-controller-manager
cloudsql-authenticator
cluster-autoscaler
cluster-proportional-autoscaler-amd64
cluster-proportional-autoscaler-arm
cluster-proportional-autoscaler-arm64
cluster-proportional-autoscaler-ppc64le
clusterapi-tester
clusterregistry
conformance-amd64
conformance-arm
conformance-arm64
conformance-ppc64le
conformance-s390x
conformance
coredns
...

查询某一镜像的版本所有版本tag

[centos@k8s-master tekton]$ curl -s https://zhangguanzhang.github.io/bash/pull.sh | bash -s search gcr.io/google_containers/coredns
1.0.1
1.0.1__amd64_linux
1.0.1__arm64_linux
1.0.1__arm_linux
1.0.1__ppc64le_linux
1.0.1__s390x_linux
1.0.6
1.0.6__amd64_linux
1.0.6__arm64_linux
1.0.6__arm_linux
1.0.6__ppc64le_linux
1.0.6__s390x_linux
1.1.3
1.1.3__amd64_linux
1.1.3__arm64_linux
1.1.3__arm_linux
1.1.3__ppc64le_linux
1.1.3__s390x_linux
1.2.2
1.2.3
1.2.4
1.2.6
1.3.0
1.3.1

拉取某一镜像

curl -s https://zhangguanzhang.github.io/bash/pull.sh | bash -s -- gcr.io/google_containers/kube-apiserver-amd64:v1.11.3
  • 安装EPEL源:
yum install epel-release
  • 安装完EPEL源后,可以查看下jq包是否存在:
yum list jq
  • 安装jq:
yum install jq
05-11 22:45