Managing secrets in a GitOps workflow
secrets in declarative pipelines.
never commit plaintext; encrypt with Sealed Secrets or SOPS, or reference an external store via External Secrets Operator.
base64-encoding a Secret and calling it secure.
What's really being asked
Whether you understand that GitOps wants everything in Git but that plaintext secrets must never go there, and whether you know concrete, safe patterns.
The full answer
The constraint is that Git is the source of truth yet must not hold readable secrets, and base64 in a Kubernetes Secret is encoding, not encryption, so it is not safe. Common patterns: Sealed Secrets, where a controller in the cluster owns an asymmetric key pair; you encrypt a Secret with the public key to produce a SealedSecret custom resource that is safe to commit, and only the in-cluster controller can decrypt it into a real Secret. SOPS, often with age or KMS, encrypts the secret values in a file you commit, and the controller or a plugin decrypts at apply time. The External Secrets Operator takes a different approach: you commit only a non-sensitive reference, and the operator fetches the actual value at runtime from an external store like HashiCorp Vault, AWS Secrets Manager, or GCP Secret Manager, then materializes a Kubernetes Secret. Combine with RBAC and encryption at rest in etcd.
The mistakes people make
Committing base64-encoded Secrets and calling them encrypted, hardcoding credentials in values files, or storing plaintext in a private repo and assuming privacy equals security.
What usually comes next
Why is base64 not secure? How does Sealed Secrets handle key rotation and disaster recovery? When prefer External Secrets over Sealed Secrets?
A concrete example
You run kubeseal against the cluster's public key to turn a Secret holding a database password into a SealedSecret resource. That encrypted resource is committed to Git and synced by Argo CD. Only the Sealed Secrets controller, holding the private key, can decrypt it into a normal Secret inside the cluster, so the password never exists in plaintext in the repository.
Interview question
Why is committing a standard Kubernetes Secret to Git unsafe even though the value is base64-encoded?
- a.Kubernetes rejects base64 Secrets that originate from Git
- b.base64 only protects values shorter than 32 characters
- c.Git automatically strips encoding from committed files
- d.base64 is reversible encoding, not encryption, so anyone can decode itCorrect
Why? this is the answer
base64 is trivially decodable, so it offers no confidentiality; the secret is effectively plaintext. Real protection requires encryption such as Sealed Secrets or SOPS, or referencing an external store.
Just read this? Test yourself on what you have been reading.
Read the original → github.com
- #gitops
- #secrets
- #security
- #sealed-secrets
- #kubernetes
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on gitops — each one lists the topics its interview covers.
See open roles