#!/bin/bash images=( k8s.gcr.io/pause:3.1=registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.1 gcr.io/google_containers/defaultbackend:1.4=registry.cn-hangzhou.aliyuncs.com/google_containers/defaultbackend:1.4 k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1=registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetes-dashboard-amd64:v1.10.1 k8s.gcr.io/heapster-influxdb-amd64:v1.3.3=registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-influxdb-amd64:v1.3.3 k8s.gcr.io/heapster-amd64:v1.5.2=registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-amd64:v1.5.2 k8s.gcr.io/heapster-grafana-amd64:v4.4.3=registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-grafana-amd64:v4.4.3 #1.22 microk8s版本 metrics-server k8s.gcr.io/metrics-server/metrics-server:v0.5.0=registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server:v0.5.0 #1.21 microk8s版本 metrics-server #k8s.gcr.io/metrics-server-amd64:v0.3.6=registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.6 #kube-system/calico-node 离线安装需要 docker.io/calico/cni:v3.19.1=docker.io/calico/cni:v3.19.1 docker.io/calico/pod2daemon-flexvol:v3.19.1=docker.io/calico/pod2daemon-flexvol:v3.19.1 docker.io/calico/node:v3.19.1=docker.io/calico/node:v3.19.1 #kube-system/calico-kube-controllers离线安装需要 docker.io/calico/kube-controllers:v3.17.3=docker.io/calico/kube-controllers:v3.17.3 #kube-system/dashboard-metrics-scraper离线安装需要 docker.io/kubernetesui/metrics-scraper:v1.0.6=docker.io/kubernetesui/metrics-scraper:v1.0.6 #kube-system/kubernetes-dashboard离线安装需要 docker.io/kubernetesui/dashboard:v2.2.0=docker.io/kubernetesui/dashboard:v2.2.0 #kube-system/coredns离线安装需要 docker.io/coredns/coredns:1.8.0=docker.io/coredns/coredns:1.8.0 ) OIFS=$IFS # 保存旧值 imagelist=() imageindex=1 for image in ${images[*]}; do IFS='=' set $image echo "准备拉取 $2" microk8s.ctr image pull $2 if [ $1 != $2 ]; then microk8s.ctr image tag $2 $1 microk8s.ctr image rm $2 fi imagelist[imageindex]=$1 imageindex=$((imageindex + 1)) echo "拉取成功" IFS=$OIFS # 还原旧值 done echo "${imagelist[*]}" microk8s.ctr image export ./dashboardAndCalicoImages.tar ${imagelist[*]} #return 0