Kubernetes Secrets Operations: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
==With kubectl CLI== | ==With kubectl CLI== | ||
{{External|[https://kubernetes.io/docs/concepts/configuration/secret/#creating-a-secret-using-kubectl-create-secret Creating a Secret Using kubectl create secret]}} | |||
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 | |||
==From a Manifest== | ==From a Manifest== |
Revision as of 17:13, 22 August 2019
Internal
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