Last active
April 25, 2022 08:55
-
-
Save zhangguanzhang/5a2998f19972eee9fc258d6d30cbfe04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 取无法拉取镜像名 | |
kubectl get po `kubectl get pod -o wide | grep Image | awk '{print $1}'` -o yaml | grep -Po 'image: \K\S+' | sort -u | |
# docker save -o images.tar.gz \ | |
imgList="" | |
while read img;do | |
if docker inspect $img &>/dev/null;then | |
imgList+="$imgList $img" | |
fi | |
done < <( kubectl get po `kubectl get pod -o wide | grep Image | awk '{print $1}'` -o yaml | grep -Po 'image: \K\S+' | sort -u) | |
docker save $img -o image.tag.gz | |
while read ctr;do | |
ResolvConfPath=`docker inspect $ctr --format "{{ .ResolvConfPath }}" ` | |
if ! grep -q use-vc $ResolvConfPath;then | |
echo 'options use-vc' >> $ResolvConfPath | |
fi | |
if ! grep -q single $ResolvConfPath;then | |
echo 'options single-request-reopen' >> $ResolvConfPath | |
fi | |
done < <(docker ps -a --filter label=io.kubernetes.docker.type=container --format '{{.ID}}' ) | |
kubectl api-resources -o name --verbs=list --namespaced | xargs -n 1 kubectl get --show-kind --ignore-not-found -n xxx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment