Sealed Secrets & SOPS for Storing Encrypted Secrets in Git
Commit encrypted secrets safely with Sealed Secrets or SOPS workflows.
In plain words
Sealed Secrets and SOPS are locked envelopes; the recipient key decides whether the cluster or CI workstation can open them. The simple Kubernetes rule is: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
Think of it like…
Sealed Secrets and SOPS are locked envelopes; the recipient key decides whether the cluster or CI workstation can open them.
Where you’ve seen it
A platform team reviews a promoted source revision and runs kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml. Expected evidence: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption. If the run instead shows this symptom, stop and restore the last known state: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model.
Words you’ll hear
- Sealed Secrets
- For this lesson, Sealed Secrets is the controlling idea: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
- SOPS
- SOPS is the checkpoint; run
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yamland inspect the owner chain. Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model. - Git
- Git is the outcome to preserve; the cost is explicit: Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities.
- Verification evidence
- The evidence command is
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml. It connects the declaration to this behavior: Commit encrypted secrets safely with Sealed Secrets or SOPS workflows.
Visual diagram
Theory & deep dive
How Sealed Secrets reaches the intended state
Commit encrypted secrets safely with Sealed Secrets or SOPS workflows. Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
The concrete checkpoint is kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml; compare the Sealed Secrets owner, SOPS state, and Git outcome instead of treating YAML acceptance as proof.
Run kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml after the change and correlate the result with Events and the owning object. Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
SOPS: failure boundary and production cost
Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model. The prerequisite contract is concrete: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities. A safe design limits blast radius, records the last good configuration, and uses kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml as a deterministic rollback checkpoint.
Capture the current state with kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model.
How it works, step by step
Step 1 of 41. Choose the source of truth
Version the source and describe the review, render, and reconciliation boundary: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
- Goal
- Commit encrypted secrets safely with Sealed Secrets or SOPS workflows.
- Owner
- Sealed Secrets
When to use it & trade-offs
What it is
Commit encrypted secrets safely with Sealed Secrets or SOPS workflows. Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
Why it matters: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model. The invariant at risk is specific: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption. The quickest fact check before changing the design is kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml.
When to reach for it
- Use Sealed Secrets to enforce this invariant: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
- Use SOPS evidence from
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yamlin reviews and incident timelines. Commit encrypted secrets safely with Sealed Secrets or SOPS workflows. - Choose the platform operator workflow route only when this cost is justified by governance or scale: Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities.
When to avoid or be careful
- Avoid assuming Sealed Secrets is complete after YAML submission; the required behavior is concrete: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
- Avoid treating the next symptom as random; check the owner and state with
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yamlfirst: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model. - Avoid adopting a heavier platform wrapper before measuring its cost: Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities.
Native, manual, and managed paths for Sealed Secrets
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml.Strengths: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
Watch out: Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities. Recovery must also recognize this signal: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model.
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml; the expected invariant is: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.Strengths: kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml gives immediate feedback without first building a platform layer.
Watch out: A manual change can hide drift, and unlike Sealed Secrets, it does not make this symptom self-documenting: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model.
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml.Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
Watch out: The added platform ownership buys value at this cost: Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities.
Interview signals & numbers to know
When this topic comes up
- Interview anchor: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
- Trace Sealed Secrets to Git through SOPS; the invariant is: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
- Recognize the symptom: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model.
- Justify the cost: Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities.
- Verify with kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml instead of only inspecting YAML.
Benchmarks & rules of thumb
- 1
- cluster controller key is the scope for classic SealedSecret encryption
- 2
- encrypted-at-rest Git workflows compared
- 0
- keys should be committed beside ciphertext
Common mistakes & follow-ups
Common interview mistakes
- Debugging only the child object misses the Sealed Secrets owner contract: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption.
- Ignoring this telltale condition leads to unrelated changes: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model.
- Repeating
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yamlwithout an owner for remediation wastes retry cost. Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities.
Likely interviewer follow-ups
- How would API output and runtime evidence prove this behavior: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption?
- Which owner object, logs, and Events would you inspect for this symptom-Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model-?
- At what threshold would this cost become unacceptable: Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities?
kubeseal -f secret.yaml -w sealedsecret.yaml; sops --decrypt env.enc.yaml, name the failure, then justify the cost. Invariant: Sealed Secrets encrypt a Kubernetes Secret for one cluster's controller key, while SOPS encrypts selected YAML fields with age, PGP, or cloud KMS for review and later decryption. Failure: Rotating the Sealed Secrets controller key or decrypting with the wrong SOPS key leaves the Git artifact unusable, and committing unencrypted files breaks the entire model. Cost: Encryption in Git supports reviewable config, but key scope, disaster recovery, ownership, and avoiding accidental plaintext diffs remain operational responsibilities.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Sealed Secrets & SOPS for Storing Encrypted Secrets in Git with generative AI interview Q&A and hands-on practice.