Storing secrets in Git feels wrong to every engineer who has been taught never to commit credentials, yet GitOps demands that your desired state lives entirely in version control. For years my team worked around this by manually applying secrets with kubectl or syncing them through a separate vault pipeline, which created blind spots and made disaster recovery painful. The moment you introduce proper secret management for GitOps, you get the best of both worlds: encrypted or referenced secrets that can be safely committed, reviewed, and reconciled just like any other manifest. In this article I’ll walk through the three patterns I have implemented in production — Bitnami Sealed Secrets, Mozilla SOPS, and External Secrets Operator — and show you when to use each one based on real operational tradeoffs.
Why Plain Kubernetes Secrets Fail the GitOps Model
In my experience, the fastest way to break GitOps is to treat secrets as an exception. You commit Deployments, ConfigMaps and NetworkPolicies to Git and let ArgoCD or Flux reconcile them, but then you inject secrets out-of-band. That split immediately undermines the core guarantees of GitOps: auditability, reproducibility, and automated drift correction. If a cluster is wiped, you cannot restore it from Git alone. If a junior engineer runs kubectl apply with the wrong file, your Git history no longer reflects what is running.
Native Kubernetes Secrets also provide very little security on their own. As described in the Kubernetes Documentation, a Secret is base64-encoded, not encrypted, and etcd encryption at rest must be explicitly enabled. Even with etcd encryption, anyone with RBAC access to read Secrets in a namespace can exfiltrate them. Committing those base64 strings to a public or even private Git repository is a breach waiting to happen. Your Git history will retain them forever, and scanners will quickly flag them.
The Requirements for a GitOps-Compatible Secret
A workable solution must allow a secret to be stored in Git without exposing plaintext, be decryptable only inside the target cluster, support key rotation, and integrate cleanly with your reconciliation loop. It should also preserve the GitOps workflow: pull requests, code review, and automated sync. All three tools covered here satisfy those constraints, but they do it with fundamentally different trust models. Sealed Secrets and SOPS encrypt the value itself and store ciphertext in Git. External Secrets Operator (ESO) stores only a reference in Git and fetches the value from an external provider at runtime.
Before choosing, I always ask teams two questions: who should be able to encrypt but not decrypt, and where is the ultimate source of truth allowed to live? The answers will point you toward client-side encryption or a centralized vault.
Sealed Secrets: Cluster-Side Encryption for Git-Safe Manifests
Sealed Secrets, originally from Bitnami, was the first tool that made GitOps secrets feel natural to me. You run a controller in your cluster that holds a private key, and developers use a client-side tool called kubeseal to encrypt Secrets with the controller’s public key. The resulting SealedSecret custom resource is safe to commit. Only the controller inside the cluster can decrypt it back into a regular Secret.
How Kubeseal Encryption Scopes Control Access
Understanding scopes prevents a lot of operational pain later. By default, Sealed Secrets uses a strict scope where the sealed secret is bound to its namespace and name. A SealedSecret for api/db-password in production cannot be decrypted if someone moves it to staging or renames it. This is exactly what you want in multi-tenant clusters. There are also namespace-wide and cluster-wide scopes that relax this binding, but I’ve found strict scope should be your default unless you have a specific templating need.
Key management is handled automatically. The controller generates a 4096-bit RSA key pair on first install and stores the private key as a Secret. You should back that key up securely and rotate it on a schedule. If you lose the private key without a backup, you cannot decrypt existing SealedSecrets after a cluster rebuild. For production, I deploy the controller with a pre-generated key stored in a KMS and backed up to secure storage.
Deploying the Controller and Sealing a Secret
Installation is straightforward with Helm or plain manifests. Once the controller is running, the workflow looks like this:
# Install the controller (helm example)
helm repo add sealed-secrets https://bitnami-labs.github.io/sealed-secrets
helm install sealed-secrets sealed-secrets/sealed-secrets \
--namespace kube-system \
--set keyRenewPeriod=720h
# Create a regular secret locally (never commit this file)
kubectl create secret generic db-creds \
--namespace production \
--from-literal=password='s3cureP@ssw0rd!' \
--dry-run=client -o yaml > db-creds.yaml
# Seal it with the cluster's public key
kubeseal --controller-name sealed-secrets \
--controller-namespace kube-system \
--format yaml < db-creds.yaml > db-creds-sealed.yaml
# db-creds-sealed.yaml can now be committed to Git
# The controller will create the plain Secret automatically
The sealed file contains an encrypted data field that is scoped to your cluster. I recommend committing both the SealedSecret and a SealedSecret rotation job to Git, so that ArgoCD can manage the lifecycle end-to-end. If you are running ArgoCD, see ArgoCD in Production: Application Sets, Sync Strategies and Multi-Cluster Management for patterns on how to exclude the generated Secret from sync diffs while still monitoring the SealedSecret.
One limitation I have hit: Sealed Secrets does not natively support templating or per-environment key separation. If you manage dozens of clusters with the same Git repo, you need either a shared key (risky) or a per-cluster re-sealing step in your pipeline.
SOPS with Age and KMS: Encrypting Files Before They Hit Git
Mozilla SOPS (Secrets OPerationS) takes a different approach. Instead of a cluster-side controller, encryption happens on the developer’s machine or in CI using Age, PGP, AWS KMS, GCP KMS, or Azure Key Vault. You encrypt entire YAML files or specific values, commit the ciphertext, and the GitOps operator decrypts at apply time. This makes SOPS extremely flexible for Helm values files and Kustomize overlays.
Where SOPS shines is partial encryption. You can encrypt only the data.password field in a Secret while leaving metadata and labels in plaintext, which keeps diffs readable. The encryption configuration lives in a .sops.yaml file at the repo root, where you define creation rules per path.
# .sops.yaml - creation rules for different environments
creation_rules:
- path_regex: environments/production/.*\.yaml
age: age1ql3z7hj432v2lg6x2q3q...production-public-key
kms: arn:aws:kms:us-east-1:123456789012:key/abcd-1234
- path_regex: environments/staging/.*\.yaml
age: age1qqf4x8k9s2p5m...staging-public-key
# Encrypt a secret file
sops --encrypt --in-place environments/production/api-secrets.yaml
# Decrypt for editing
sops --decrypt environments/production/api-secrets.yaml
Bringing SOPS Decryption into Flux and ArgoCD
Neither ArgoCD nor Flux can decrypt SOPS files without help. For Flux, the kustomize-controller has native SOPS support — you set decryption.provider: sops and provide Age or KMS keys via a Secret in the cluster. For ArgoCD, I’ve had the best results using the KSOPS plugin or the argocd-vault-plugin with SOPS. The operator reads the encrypted file from Git, decrypts it in memory, and applies the plaintext Secret without ever writing it back to Git.
In my experience, SOPS works best when you already use Kustomize extensively. Combining SOPS with something like Flux CD for Kubernetes: GitOps Automation with Kustomize and Helm gives you a clean pattern where environment overlays contain encrypted secrets alongside plain manifests. The downside is key distribution. Every developer who needs to add a secret must have access to the Age private key or KMS permissions, and CI also needs decrypt access. Rotate your Age keys annually and automate re-encryption in your pipeline to avoid stale ciphertext.
External Secrets Operator: Leaving Secrets Out of Git Entirely
External Secrets Operator solves the problem by not storing the secret value in Git at all. Instead, you commit an ExternalSecret resource that declares where to fetch the secret from — AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager, Azure Key Vault, or others. The operator runs in-cluster, authenticates to the external provider, polls for the value, and creates a native Kubernetes Secret.
This model has become my default for organizations with centralized security requirements. Secrets are managed in one place with full audit logging, fine-grained IAM, and automatic rotation. Git only holds a reference, so there is no ciphertext to manage and no risk of committing a plaintext leak. It also simplifies multi-cluster scenarios: each cluster fetches the same secret reference but authenticates with its own IRSA or Workload Identity.
Configuring SecretStore and ExternalSecret Resources
You define two resources. A SecretStore or ClusterSecretStore configures authentication to the provider, and an ExternalSecret maps external keys to Kubernetes Secret fields.
---
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: aws-secrets-manager
spec:
provider:
aws:
service: SecretsManager
region: us-east-1
auth:
jwt:
serviceAccountRef:
name: external-secrets-sa
namespace: external-secrets
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: api-db-password
namespace: production
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: aws-secrets-manager
target:
name: db-creds
creationPolicy: Owner
deletionPolicy: Retain
data:
- secretKey: password
remoteRef:
key: production/api/db
property: password
# Optional templating
dataFrom:
- extract:
key: production/api/db
The refreshInterval is critical. Set it too low and you will throttle your provider; too high and rotation lags. I typically use 15m to 1h for production and rely on Drift Detection and Reconciliation: Keeping Clusters in Sync with Git patterns to alert if the generated Secret diverges from the external source. ESO also supports PushSecret if you need to push values back to the provider, though I rarely use it in pure GitOps flows.
Compared to Sealed Secrets and SOPS, ESO adds an external dependency. If Vault or AWS is down, new pods may fail to mount secrets and new clusters cannot bootstrap. I always configure a deletionPolicy: Retain so an accidental delete of the ExternalSecret does not wipe the live Secret, and I monitor the ExternalSecret status conditions with Prometheus alerts.
Secret Rotation, Revocation and Audit Without Breaking Reconciliation
Encrypting secrets is only half the job. Rotation is where many GitOps secret implementations fail silently. With Sealed Secrets, rotation means re-sealing the new value and committing. Old ciphertext remains in Git history forever, which is acceptable because it is still encrypted, but you must also rotate the controller’s private key periodically. I automate this with a CronJob that generates a new key, re-seals all secrets, and opens a pull request — never rotate keys by hand.
With SOPS, rotation is cleaner because you can re-encrypt all files with a single command: sops updatekeys environments/production/*.yaml. In my pipelines I run this after any Age or KMS key rotation. For ESO, rotation happens in the external provider and the operator picks it up on the next refresh. This is the smoothest experience, but it means your Git history does not capture the rotation event. I compensate by emitting Kubernetes Events and forwarding ESO metrics to our observability stack.
Auditing is equally important. Sealed Secrets and SOPS leave an audit trail in Git — every change to a secret is a commit with a diff of ciphertext. ESO shifts auditing to the external provider’s logs. In regulated environments I prefer ESO because Vault and AWS provide stronger non-repudiation than Git diffs. Whichever tool you choose, enable Kubernetes audit logs for Secret access and restrict RBAC so only the controller or ESO service account can read plaintext.
Deciding Between Sealed Secrets, SOPS and ESO for Your Platform
There is no single winner. I have run all three in production, sometimes in the same organization for different teams. Sealed Secrets is ideal when you want zero external dependencies and a simple mental model: encrypt with public key, decrypt in cluster. SOPS is best when you need flexible file-level encryption and already live in Kustomize or Helm. ESO is the right fit when security mandates a central vault and you want native rotation and IAM.
Cost and complexity differ. Sealed Secrets is free and lightweight but forces you to manage key backups yourself. SOPS leverages existing KMS but spreads encryption keys to every developer and CI runner. ESO requires running and securing an external secret store, which for small teams can be overkill. For edge or air-gapped clusters, I avoid ESO entirely because the external dependency becomes a liability.
| Capability | Sealed Secrets | SOPS (Age/KMS) | External Secrets Operator |
|---|---|---|---|
| Secret lives in Git | Yes, as encrypted SealedSecret CR | Yes, as encrypted YAML values | No, only reference in Git |
| Decryption location | In-cluster controller | Flux/ArgoCD plugin at sync time | In-cluster operator fetching from vault |
| Key management | Controller RSA key pair | Age/PGP or cloud KMS keys | Provider IAM / Vault policies |
| Rotation effort | Re-seal and commit, rotate controller key | Re-encrypt files with new key | Rotate in provider, auto-refreshed |
| Multi-cluster reuse | Requires per-cluster seal or shared key | Shared .sops.yaml with per-env keys | Same reference, per-cluster auth |
| Offline / air-gapped support | Excellent | Good if keys available | Poor without provider connectivity |
If you are just starting with GitOps, I suggest Sealed Secrets for its low barrier to entry. Once your platform grows to multiple environments and teams, evaluate a move to SOPS or ESO. For teams already invested in ArgoCD, pairing ESO with Environment Promotion in GitOps: From Dev to Production with Confidence gives you a strong model where promotion moves only the ExternalSecret reference, while the actual value stays secured per environment in your vault. Whichever path you pick, document it as a platform decision and enforce it via policy — mixing all three without clear boundaries creates confusion about where truth lives.
Frequently Asked Questions
Can I use Sealed Secrets and External Secrets Operator together in one cluster?
Yes, many teams do. A common pattern is to use Sealed Secrets for bootstrap secrets like the ESO provider credentials or ArgoCD admin password, and ESO for all application secrets that live in Vault or AWS Secrets Manager. Keep the responsibilities separated and label which controller owns each Secret to avoid conflicts.
How do I safely rotate the Sealed Secrets private key without downtime?
Add the new private key as an additional key to the controller without removing the old one, then re-seal all SealedSecrets with the new public key and commit. Once reconciliation is complete and all Secrets are re-encrypted, remove the old key. The controller can hold multiple keys and will try each until decryption succeeds, so there is no outage if you follow this sequence.
Does SOPS decryption expose plaintext secrets in GitOps controller logs?
It should not if configured correctly. Both Flux and ArgoCD with KSOPS decrypt in memory and never log the plaintext. However, avoid enabling verbose debug logging on the controllers and ensure your CI does not echo decrypted files. I also recommend setting creationPolicy: Owner and restricting log access via RBAC.
What happens if the external provider is unavailable when ESO tries to sync?
ESO will keep the last successfully synced Kubernetes Secret and mark the ExternalSecret status as degraded with a SecretSyncedError condition. Existing workloads continue to run, but new pods may use a stale value until the provider recovers. Configure alerts on the externalsecret_status_condition metric and keep refreshInterval reasonable to avoid throttling when the provider comes back.