Open imdingtalk opened 4 months ago
registry.cn-shenzhen.aliyuncs.com/imdingtalk/kube-apiserver:v1.28.4
registry.cn-shenzhen.aliyuncs.com/imdingtalk/kube-controller-manager:v1.28.4
registry.cn-shenzhen.aliyuncs.com/imdingtalk/kube-scheduler:v1.28.4
registry.cn-shenzhen.aliyuncs.com/imdingtalk/kube-proxy:v1.28.4
registry.cn-shenzhen.aliyuncs.com/imdingtalk/pause:3.9
registry.cn-shenzhen.aliyuncs.com/imdingtalk/etcd:3.5.9-0
registry.cn-shenzhen.aliyuncs.com/imdingtalk/coredns:v1.10.1
registry.k8s.io/kube-apiserver:v1.28.4
registry.k8s.io/kube-controller-manager:v1.28.4
registry.k8s.io/kube-scheduler:v1.28.4
registry.k8s.io/kube-proxy:v1.28.4
registry.k8s.io/pause:3.9
registry.k8s.io/etcd:3.5.9-0
registry.k8s.io/coredns/coredns:v1.10.1
获取阿里云镜像加速地址
根据提示配置镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
将镜像信息部分的的两个文件保存到本地
然后愉快的使用以下脚本跑起来
适用于无法拉取外网地址或拉取外网地址缓慢
img=$(cat dockerhub-image.yml)
for i in ${img[@]}
do
tagName=$(echo $i | awk -F "/" '{print $NF}');
docker pull $i;
sourceTag=$(cat images-init.yml | grep $tagName);
docker tag $i $sourceTag;
done
适用于内网环境需要将公网镜像打包到内网镜像仓库
img=$(cat dockerhub-image.yml)
for i in ${img[@]}
do
tagName=$(echo $i | awk -F "/" '{print $NF}');
filePrefix=$(echo $tagName | awk -F ":" '{print $1}');
fileSuffix=$(echo $tagName | awk -F ":" '{print $NF}');
fileName=$filePrefix--$fileSuffix.gz
docker pull $i;
mkdir localImage || echo 0
docker save $i -o localImage/$fileName
done
# tar -zcf localImage.tar.gz localImage
# 将压缩好的镜像文件放在localImage目录
img=$(ls localImage)
# 本地仓库信息 LOCAL_REGISTRY 和 LOCAL_NAMESPACE 需要指定
# 如镜像local.harbor.dev/ingress-nginx/kube-webhook-certgen:v1.1.1
# LOCAL_REGISTRY则为:local.harbor.dev
# LOCAL_NAMESPACE则为:ingress-nginx
LOCAL_REGISTRY=
LOCAL_NAMESPACE=
# 首先解压镜像
for i in ${img[@]}
do
docker load -i $i;
done
# 解压完成后,重新打tag并且上传指定仓库,需要确保需要有对应仓库的权限
img=$(cat dockerhub-image.yml)
for i in ${img[@]}
do
tagName=$(echo $i | awk -F "/" '{print $NF}');
specialTag=$LOCAL_REGISTRY/$LOCAL_NAMESPACE/$tagName;
docker tag $i $specialTag;
docker push $specialTag;
done
nginx
registry.k8s.io/kube-apiserver:v1.28.4 registry.k8s.io/kube-controller-manager:v1.28.4 registry.k8s.io/kube-scheduler:v1.28.4 registry.k8s.io/kube-proxy:v1.28.4 registry.k8s.io/pause:3.9 registry.k8s.io/etcd:3.5.9-0 registry.k8s.io/coredns/coredns:v1.10.1