k8s - opaque secret
As you already know, k8s have many secrets - opaque, tls (certificate), service account, ssh, docker secret, boostrap token secret.
Opaque secret
Creating a single secret (username in this case)
kubectl create secret generic user-info --from-literal=user_secret=mysecret
Creating a secret with multiple key
kubectl create secret generic user-info --from-literal=user_secret=mysecret --from-literal=user_password=password
From file
We can create secret from file using the following command :-
kubectl create secret generic user-info-file --from-file=./username.txt --from-file=password.txt
The filename will be used as key
Using secret from environment variables
The yaml here shows you how to reference/user secrets in your pod
Comments