blog/kubernetes/installation/scripts/get_images.sh

15 lines
552 B
Bash

#!/bin/bash
HTTPS_PROXY=$1
IMAGE_REGISTRY=$2
IMAGE_REGISTRY_USER=$3
IMAGES=$(kubeadm config images list | grep k8s.gcr.io)
for IMAGE in ${IMAGES[@]}
do
echo "pull image ${IMAGE}"
https_proxy=${HTTPS_PROXY} ctr images pull --all-platforms ${IMAGE}
IMAGE_NAME=$(echo ${IMAGE}|sed -e 's|.*/||g')
ctr images tag ${IMAGE} ${IMAGE_REGISTRY}/${IMAGE_NAME}
ctr images push -k -u ${IMAGE_REGISTRY_USER} ${IMAGE_REGISTRY}/${IMAGE_NAME}
# ctr images rm ${IMAGE}
done
#192.168.0.144:1080 ccr.ccs.tencentyun.com/kgcrio 100004225373:Hello2022