SOPS, Sealed Secrets and External Secrets

GitOps-friendly ways to keep secrets in or near Git safely: encrypted files, cluster-sealed secrets, and operators that sync from secret managers.

Intermediate · about 4 hours · difficulty 3/5

Learn first: Secrets Management Fundamentals, GitOps Principles

GitOps wants everything in Git, but secrets must not be readable there. Three patterns solve this, and most teams pick one.

SOPS

SOPS encrypts the *values* in YAML, JSON, ENV or INI files while leaving keys readable, so diffs still make sense. Keys come from age, PGP or a cloud KMS. A .sops.yaml file sets which keys encrypt which paths. Decrypt at deploy time: Flux decrypts natively, Argo CD can via plugins, and Terraform and Helm have integrations. Access is controlled by who can use the KMS key.

Sealed Secrets

The Sealed Secrets controller holds a private key inside the cluster. You encrypt with the public key using kubeseal, commit the resulting SealedSecret, and only that cluster can decrypt it into a normal Secret. Simple, but secrets are tied to one cluster and the controller key must be backed up.

External Secrets Operator

ESO keeps the real values in a secret manager (AWS Secrets Manager, Vault, Azure Key Vault, Google Secret Manager). You commit an ExternalSecret that references a key, and the operator creates and refreshes the Kubernetes Secret. Rotation happens in one place, and Git holds no ciphertext at all. A SecretStore or ClusterSecretStore configures access, ideally through workload identity.

Choosing

  • Small team, one cluster: Sealed Secrets or SOPS with age.
  • Already on a cloud secret manager or Vault: External Secrets Operator.
  • Need secrets for non-Kubernetes tools too: SOPS.

Good enough to move on: you can encrypt a values file with SOPS and age, create a SealedSecret, and sync a secret from a cloud secret manager with External Secrets, and explain which you would pick for a given team.

Key concepts

  • SOPS with age or KMS
  • .sops.yaml creation rules
  • Sealed Secrets and kubeseal
  • External Secrets Operator
  • SecretStore and workload identity
  • Choosing a pattern

Mini project

In your GitOps config repo, store one secret with SOPS, one as a SealedSecret and one via External Secrets from a cloud secret manager, then document the rotation steps for each.

Check yourself

Your cluster is destroyed and rebuilt. Which of the three approaches can recover its secrets without extra steps, and which needs a backed-up key?

Free resources