Secret
What is Secret?
Secret: Like a ConfigMap but for sensitive data — passwords, tokens, TLS keys. Stored base64-encoded and handled with extra care by the API. A Secret in Kubernetes stores sensitive data such as passwords, API keys and TLS certificates. Pods use it as environment variables or as files, just like a ConfigMap.
Frequently asked questions about Secret
How is Secret used in practice?
By default, Secrets are only base64-encoded, which is not encryption. Anyone who can read Secrets in a namespace can read the values. Their protection comes from access rules, and from encryption at rest, which most managed clusters enable.
What should you keep in mind with Secret?
Restrict who can read Secrets with RBAC, and never commit them to Git in plain form. Tools like Sealed Secrets, SOPS or the External Secrets Operator let you store encrypted versions in Git or pull values from a secret manager. Rotate secrets when people leave or after an incident, and restart pods afterwards, because environment variables are only read at start-up.
What does an example of Secret look like?
apiVersion: v1 kind: Secret metadata: name: db-creds type: Opaque stringData: password: s3cr3t At a glance
| Category | Kubernetes |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |