Skip to content

Instantly share code, notes, and snippets.

@Laxman-SM
Created March 5, 2020 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Laxman-SM/3e0776a4498a55698e51904cf51020d9 to your computer and use it in GitHub Desktop.
Save Laxman-SM/3e0776a4498a55698e51904cf51020d9 to your computer and use it in GitHub Desktop.
Get all the kubernetes objects YAML from your cluster
for n in $(kubectl get -o=name namespaces | cut -f 2 -d "/"); do
for o in $(kubectl get -o=name pvc,configmap,serviceaccount,secret,ingress,service,deployment,statefulset,hpa,job,cronjob --namespace $n); do
mkdir -p $(dirname $o)
kubectl get -o=yaml --export $o --namespace $n >$o.yaml
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment