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

Two ExternalSecrets write to the same target Secret and its keys flip every refresh cycle

IntermediateTroubleshootingSecrets management: Vault, External Secrets and SOPS
Answer

Likely causes → Both use creationPolicy: Owner, so each one replaces the full Secret data with its own keys.

Diagnose →

kubectl get externalsecret -n prod -o custom-columns=NAME:.metadata.name,TARGET:.spec.target.name,POLICY:.spec.target.creationPolicy
kubectl get secret app -o yaml | yq '.metadata.ownerReferences'

Fix → Merge the data into one ExternalSecret with several data entries, or set the second one to creationPolicy: Merge so it only adds its keys to a Secret owned by the first.

Prevent → Use the convention of one target Secret per ExternalSecret, enforced by a policy that rejects duplicate spec.target.name values within a namespace.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets management: Vault, External Secrets and SOPS