External secrets and sealed secrets

Intermediate · 12 min

Getting secrets into a GitOps cluster without committing them: Sealed Secrets, the External Secrets Operator, the Secrets Store CSI driver and trade-offs.

Before thisSecrets, and what they do not protectThe downward API and projected volumes

Infisical · 12 min

External secrets and sealed secrets

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by InfisicalReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • GitOps wants every object in Git, and a Secret in Git is a leaked password. The tools here either encrypt the Secret for Git or keep the value outside the cluster's manifests altogether.
  • Sealed Secrets encrypts a Secret with the cluster controller's public key. Anyone can seal, only that controller can unseal, and by default the ciphertext is bound to one name and namespace.
  • The External Secrets Operator syncs values from a store such as AWS Secrets Manager, Vault or Azure Key Vault into ordinary Secrets, on a refreshInterval, using a SecretStore and an ExternalSecret.
  • Both end with a normal Secret in etcd, so encryption at rest and RBAC still matter. The Secrets Store CSI driver and agent injectors can skip the Secret object and write the value straight into the Pod.
  • The authentication problem doesn't vanish. ESO and CSI providers usually prove the Pod's identity to the store with a projected, audience-scoped service account token.

The GitOps hole

With GitOps, Git is the source of truth and a controller makes the cluster match it. That works for Deployments and ConfigMaps. Then you reach the database password. A Secret manifest in Git is a password in Git, because base64 is not encryption. Leave it out and the repo no longer describes the cluster. Someone has to kubectl create secret by hand, and nobody remembers how.

There are two ways out of the hole. You can encrypt the Secret so it’s safe to commit, or you can commit a pointer and keep the value in a real secret store. Sealed Secrets and SOPS take the first road. The External Secrets Operator, the Secrets Store CSI driver and agent injectors take the second.

Sealed Secrets: a lockbox only the cluster can open

Think of a bank’s night deposit slot. Anyone can drop an envelope in. Only the bank can open the safe behind it. Sealed Secrets works the same way. A controller in the cluster holds a private key. You fetch its public certificate and seal locally with kubeseal:

kubectl -n payments create secret generic db-creds \
  --from-literal=password='s3cr3t-Pa55' --dry-run=client -o yaml \
  | kubeseal --cert sealing.pem --format yaml > db-creds.sealed.yaml

The output is a SealedSecret custom resource that is safe to commit:

apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
  name: db-creds
  namespace: payments
spec:
  encryptedData:
    password: AgBSOwl+hb5li3p6dm9Z0+H69xKsX2RoCayUuQGjpX85t3yiRH3M...
  template:
    metadata: {name: db-creds, namespace: payments}

The controller watches SealedSecrets, decrypts them and writes the real Secret next to them. Each value is encrypted with a fresh symmetric key, which is itself encrypted with the controller’s RSA key.

By default the namespace and name are mixed into the encryption. We sealed payments/db-creds against a key pair we made ourselves and decrypted it with kubeseal --recovery-unseal. That worked. Then we changed namespace: payments to staging in the file and tried again: no key could decrypt secret (password). That’s the point of the default strict scope. Someone who can create SealedSecrets in their own namespace can’t replay your ciphertext there to read it. --scope namespace-wide or cluster-wide loosens this when you need to.

The costs are operational. The controller generates a new key every 30 days by default and keeps the old ones, so old SealedSecrets still decrypt, but they aren’t re-encrypted unless you reseal them. The private keys live as Secrets in the controller’s namespace. Lose them and every SealedSecret in Git is unreadable. Back them up with the same care as the etcd snapshot. Rotating the password itself still means resealing and committing. The project moved from bitnami-labs to github.com/bitnami/sealed-secrets and is at v0.41 as of November 2026.

SOPS is the other encrypt-for-Git option: it encrypts the values in a YAML file with age, PGP or a cloud KMS, and Flux decrypts natively. The devops secrets lesson covers it.

The External Secrets Operator: a pointer in Git

ESO keeps the value where your security team already wants it, in AWS Secrets Manager, Google Secret Manager, Azure Key Vault, Vault or one of dozens of other stores. Git holds two small objects. A SecretStore says how to reach the store and authenticate:

apiVersion: external-secrets.io/v1
kind: SecretStore
metadata: {name: aws, namespace: payments}
spec:
  provider:
    aws:
      service: SecretsManager
      region: eu-west-1
      auth:
        jwt:
          serviceAccountRef: {name: payments-app}

An ExternalSecret says which values to fetch and what Secret to build:

apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata: {name: db-creds, namespace: payments}
spec:
  refreshInterval: 1h
  secretStoreRef: {name: aws, kind: SecretStore}
  target:
    name: db-creds
    creationPolicy: Owner
  data:
  - secretKey: password
    remoteRef: {key: prod/payments/db, property: password}

ESO’s controller reconciles this into a normal Secret and re-fetches every refreshInterval, so a rotation in the store reaches the cluster without a commit. A ClusterSecretStore lets one store serve many namespaces. PushSecret goes the other way, and generators can mint values such as registry tokens.

The jwt auth above is the projected token idea again: ESO requests a short-lived token for that service account, and the cloud trusts the cluster’s issuer. That avoids the “secret zero” of storing a long-lived cloud key in a Secret just to fetch the other Secrets.

Two warnings. Old tutorials use external-secrets.io/v1beta1 or v1alpha1. In the v2.15 CRDs (November 2026) only v1 is served. Applying a v1beta1 ExternalSecret against them fails with no matches for kind "ExternalSecret" in version "external-secrets.io/v1beta1". And ESO’s output is an ordinary Secret: anyone who can read Secrets in the namespace reads it. The source of truth moved, but the cluster copy needs the same encryption at rest and RBAC as before.

Skipping the Secret object

If you don’t want the value in etcd at all, the Secrets Store CSI driver mounts it from the store straight into the Pod as a volume, through a provider plugin for each store, again authenticating with the Pod’s token. Syncing to a Secret is optional and off unless you configure it. Agent injectors, such as Vault’s, add a sidecar that fetches and renews secrets into a shared in-memory volume. Both keep values out of the API, at the price of a dependency on the store being reachable when Pods start.

A rough guide: Sealed Secrets or SOPS for small teams without a secret store, ESO when a store already exists and apps expect Secrets, and CSI or an injector when policy says secrets must never sit in etcd.

About the video

The embed is Infisical’s “Secrets Management in Kubernetes: Foundations”, February 2026, 12 minutes. Its timestamps cover what Kubernetes gives you, a short demo of injecting secrets, why native secrets break down, Sealed Secrets and GitOps, ESO with centralized stores, the CSI pattern, and agent injection versus CSI. That’s this lesson’s map almost one to one. Infisical sells a secrets platform, and the description says the video shows where it fits, so expect the product near the end. Judged from the timestamps and description, since transcripts can’t be fetched here. It carries no audio-track language flag and has an English caption track. Chris Matcham’s vendor-neutral ESO video is in deeper.

What was run: against a local v1.37.3 API server whose nodes run no containers, we installed the SealedSecret CRD and ESO v2.15.0’s CRDs, applied the SealedSecret and the v1 SecretStore and ExternalSecret above, and saw v1beta1 rejected. kubeseal v0.41.2, built with go install, sealed and unsealed offline against a key pair we generated, and the namespace swap failed to decrypt. Neither controller ran (running the Sealed Secrets controller locally was not permitted here) and no cloud store was contacted, so the unsealing and syncing behaviour is from each project’s docs, checked 2026-11-28.

Where this fits

That closes configuration. Networking starts with the rule every cluster network has to satisfy. Next: the Kubernetes network model and CNI.

Check yourself

  1. 01You copy a SealedSecret from the payments namespace into staging. The controller logs an error and no Secret appears. Why?

    With the default strict scope the namespace and name are mixed into the encryption, so the ciphertext only decrypts as payments/db-creds. Reseal it for staging, or seal with --scope namespace-wide or cluster-wide if moving it should be allowed.

  2. 02Your cluster is destroyed and rebuilt from Git. Every SealedSecret fails to decrypt. What was missed?

    The controller's private keys, stored as Secrets in its namespace. A fresh controller generated new keys. Back up the sealing keys, or bring your own key, as part of disaster recovery.

  3. 03Someone rotates the database password in AWS Secrets Manager. When does the app see it with ESO?

    ESO updates the Kubernetes Secret on its next refresh, set by refreshInterval. After that, Pods see it only through the Secret's normal channels: a mounted volume updates in place, env vars need a restart.

  4. 04Why is ESO not a fix for someone with list on secrets in the namespace?

    ESO writes an ordinary Secret, which that person can read like any other. ESO moves the source of truth out of Git and the cluster, but the copy it makes is protected only by RBAC and encryption at rest.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark