codegurukool.com · Free coding tutorials & online compiler

Home › Kubernetes Tutorial › Secrets

Secrets

Store passwords and tokens.

A Secret holds sensitive data such as passwords and API keys. Values are stored base64-encoded, which is not encryption: restrict access with RBAC and enable encryption at rest for real protection. Decode a value with base64 -d.

Example code

kubectl create secret generic db-pass --from-literal=password=S3cret!
kubectl get secret db-pass -o jsonpath='{.data.password}'

Run this code in the online editor

← ConfigMapsUse ConfigMaps and Secrets in a Pod →