A small Bash utility that decodes all Base64 values in a Kubernetes Secret YAML, making them human-readable at a glance.
kubectl get secret -o yaml returns Base64-encoded values under .data. This script reads that YAML from stdin, decodes every entry, and prints the results as plain key-value pairs.
kubectl get secret <SECRET_NAME> -o yaml | ./plain-secret.shOr from a file:
cat my-secret.yaml | ./plain-secret.shGiven a Secret YAML with:
data:
DB_HOST: bXlkYi5leGFtcGxlLmNvbQ==
DB_USER: YWRtaW4=
DB_PASS: czNjcjN0Running:
cat my-secret.yaml | ./plain-secret.shOutputs:
DB_HOST: mydb.example.com
DB_USER: admin
DB_PASS: s3cr3t