The Kubernetes export script writes Secret objects to a local file
Source references: 1The export command explicitly includes `secret` and redirects the complete YAML to an output file. Kubernetes Secret values are commonly Base64-encoded, not encrypted.
Anyone able to read the directory, backups, build artifacts, or attached logs may obtain database passwords, tokens, or certificate material.
The active export script serializes Kubernetes `secret` objects with other resources into local `all-resources.yaml`. When run, Secret data is generally Base64-encoded, not encrypted; credentials could leak if the directory is committed, backed up, or readable by others. The user can require secrets to be excluded by default, exporting only names/references, with restricted output permissions and retention.
set -euo pipefailNAMESPACE="${K8S_NAMESPACE:-<namespace>}"OUTPUT_DIR="${OUTPUT_DIR:-k8s-export}"mkdir -p "$OUTPUT_DIR"kubectl get deploy,svc,ingress,configmap,secret -n "$NAMESPACE" -o yaml > "$OUTPUT_DIR/all-resources.yaml"for deploy in $(kubectl get deploy -n "$NAMESPACE" -o jsonpath='{.items[*].metadata.name}'); do kubectl get deployment "$deploy" -n "$NAMESPACE" -o yaml > "$OUTPUT_DIR/deploy-${deploy}.yaml"done