Kubernetes Secrets Operations
Jump to navigation
Jump to search
Internal
Inspecting Secrets
kubectl get secrets
kubectl describe secret username-and-password
Create a Secret
With kubectl CLI
Declare the secret content in one (or more) file(s) on the local filesystem. When the secret is exposed to a pod, the content will be available as volume files with the same name.
echo -n "test-user" > ./username.txt echo -p "test-password" > ./password.txt
kubectl create secret generic username-and-password --from-file=./username.txt --from-file=./password.txt
Special Character Handling
Special characters such as '$', '*' and '!' require escaping (\).