blog/kubernetes/installation/scripts/get_images.sh

24 lines
1.2 KiB
Bash

#!/bin/bash
HTTPS_PROXY=$1
IMAGE_REGISTRY=$2
IMAGE_REGISTRY_USER=$3
IMAGES=$(kubeadm config images list | grep registry.k8s.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
#192.168.0.144:1080 ccr.ccs.tencentyun.com/kgcrio 100004225373:Hello2022
https_proxy=192.168.0.200:1080 ctr images pull --all-platforms registry.k8s.io/prometheus-adapter/prometheus-adapter:v0.10.0
https_proxy=192.168.0.200:1080 ctr images pull --all-platforms registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.8.2
ctr images tag registry.k8s.io/prometheus-adapter/prometheus-adapter:v0.10.0 registry.cn-hangzhou.aliyuncs.com/slmgoogle/prometheus-adapter:v0.10.0
ctr images tag registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.9.2 registry.cn-hangzhou.aliyuncs.com/slmgoogle/kube-state-metrics:v2.9.2
registry-vpc.cn-hangzhou.aliyuncs.com/slmgoogle