2018年10月18日 | Leave a comment 问题: 如何备份 k8s yaml 配置 解决: for n in $(kubectl get -o=name pvc,configmap,serviceaccount,secret,ingress,service,deployment,statefulset,hpa,job,cronjob) do mkdir -p $(dirname $n) kubectl get -o=yaml --export $n > $n.yaml done 12345 for n in $(kubectl get -o=name pvc,configmap,serviceaccount,secret,ingress,service,deployment,statefulset,hpa,job,cronjob)do mkdir -p $(dirname $n) kubectl get -o=yaml --export $n > $n.yamldone 参考: https://github.com/kubernetes/kubernetes/issues/24873