Kubernetes provides an object called 'Secret' that deals with the challenge of configuring sensitive data like passwords, tokens, keys, etc. without exposing this valuable data within images or Pod Specs. Secrets can be utilized either as volumes or as environment variables.
The Various Types of Secrets
Secrets in Kubernetes come in three different types:
Opaque: This is a Secret that is formatted in base64 encoding and used to store sensitive elements like passwords, keys, etc. However, it only offers weak encryption security as the data can be decoded back to the original form using base64 --decode.
kubernetes.io/dockerconfigjson: This type of Secret is used to maintain authentication information of a private Docker registry.
kubernetes.io/service-account-token: This variety is referred to by service accounts. When a service account is created, Kubernetes will automatically generate a paired secret. If a Pod utilizes a service account, the matching secret will be automatically mounted to the directory: /run/secrets/kubernetes.io/serviceaccount within the Pod.
Note: A service account enables a Pod to access the Kubernetes API.
API Version Corresponding Chart
Kubernetes Version
Core API Version
Opaque Secret
The data for this type is a map requiring the value to be in base64 encoding format: