Interview Prep/DevSecOps/Secrets management: Vault, External Secrets and SOPS

A SealedSecret works in `staging` but fails in `prod` with `no key could decrypt secret` after being copied there

BeginnerTroubleshootingSecrets management: Vault, External Secrets and SOPS
Answer

Likely causes → The default scope is strict. The ciphertext is bound to the original name and namespace, so changing either breaks decryption, even on the same controller.

Diagnose → kubectl get sealedsecret db -n prod -o yaml | yq '.metadata.annotations' shows no cluster-wide or namespace-wide annotation.

Fix → Re-seal for the target namespace:

kubectl create secret generic db --from-literal=password=... --dry-run=client -o yaml \
  | kubeseal --namespace prod --format yaml > prod/db-sealed.yaml

Prevent → Seal per environment from source values. Use --scope cluster-wide only when you deliberately want the ciphertext portable.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets management: Vault, External Secrets and SOPS