Skip to content

Instantly share code, notes, and snippets.

Last active October 21, 2022 01:36
What would you like to do?
Google Cloud Artifact Registry: Kubernetes v1.24.0

Upload staging images to Google Artifact Registry

This is specifically for testing unreleased k8s components. Most of this is from

Pre Reqs


Each release includes a compressed file that includes the container images and artifacts. These can be found in the latest server-binaries link from the CHANGELOG.

Get the container images on disk and load them into docker.

curl -LO

Extract only the stuff we care about (/bin).

tar xvf kubernetes-server-linux-amd64.tar.gz --strip=2 --wildcards "*/bin"

Load images into Docker.

export array=(kube-apiserver kube-controller-manager kube-scheduler kube-proxy)

for i in "${array[@]}"; do
  sudo docker load -i bin/$i.tar

Output is similar to:

250f75829aad: Loading layer [==================================================>]  1.509MB/1.509MB
e4532922ece0: Loading layer [==================================================>]  131.3MB/131.3MB
Loaded image:
c71194ba6df3: Loading layer [==================================================>]  121.1MB/121.1MB
Loaded image:
f146ae1f263c: Loading layer [==================================================>]  49.62MB/49.62MB
Loaded image:
27109972a1c4: Loading layer [==================================================>]  44.15MB/44.15MB
Loaded image:

We also need to ensure we have the images (either already local or pull them)

sudo docker pull
sudo docker pull
sudo docker pull
sudo docker pull

Google Artifact Registry

Create a Google Artifact Registry in GCP & move images to GAR. The following assumes you have a gcloud CLI configured to the project above you are using (gcloud auth login).

gcloud auth login

Follow the recommendation for setup.

# ex: gcloud artifacts repositories create k8s-testing --repository-format=docker \
--location=us-central1 --description="Docker repository"

gcloud auth configure-docker

Tag and move images.

for i in "${array[@]}"; do
  sudo docker tag$i-amd64:v1.24.0-alpha.1$i:v1.24.0-alpha.1 && sudo docker push$i:v1.24.0-alpha.1

Do the additional images too.

# Tag 'em
sudo docker tag
sudo docker tag
sudo docker tag
sudo docker tag

# Push 'em
sudo docker push
sudo docker push
sudo docker push
sudo docker push

Make images public (

gcloud artifacts repositories add-iam-policy-binding k8s-testing --location=us-central1 --member=allUsers --role=roles/artifactregistry.reader --project out-of-pocket-cloudlab


Updated IAM policy for repository [k8s-testing].
- members:
  - allUsers
  role: roles/artifactregistry.reader
etag: BwXS_MvXa94=
version: 1

When using with kubeadm, specify the image path with --image-repository string. For example, --image-repository ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment