Created
March 9, 2023 15:23
-
-
Save lbr88/6156b3773fe0c98b793aaa39b53f808b to your computer and use it in GitHub Desktop.
Export "all" resources from kubernetes to yaml. Requires kubectl plugin neat
This file contains 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
#!/bin/bash | |
kubectl get -A -o custom-columns="kind":.kind,"name":.metadata.name,"namespace":.metadata.namespace pvc,configmap,serviceaccount,secret,ingress,service,deployment,statefulset,hpa,job,cronjob,replicaset --no-headers | while read kind name namespace | |
do | |
#echo $kind | |
#echo $namespace | |
#echo $name | |
mkdir -p "${namespace}" | |
echo "${namespace}:${kind}/${name}" | |
kubectl get -o=yaml -n "$namespace" "${kind}/${name}" |kubectl neat > "${namespace}/${kind}-${name}.yaml" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment