$ kubectl create secret generic db-user-pass \
--from-literal=username=admin \
--from-literal=password='marslo'
$ echo -n 'admin' > ./username.txt
$ echo -n 'marslo' > ./password.txt
$ kubectl create secret generic db-user-pass \
--from-file=./username.txt \
--from-file=./password.txt
# or `--from-file=[key=]source`
$ kubectl create secret generic db-user-pass \
--from-file=username=./username.txt \
--from-file=password=./password.txt
$ echo -n 'admin' | base64
YWRtaW4=
$ echo -n '1f2d1e2e67df' | base64
MWYyZDFlMmU2N2Rm
# create manifest
$ cat secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
# create
$ kubectl apply -f ./secret.yaml
$ kubectl get secret db-user-pass -o jsonpath='{.data}'
{ "password": "bWFyc2xvCg==", "username": "YWRtaW4=" }
$ echo 'bWFyc2xvCg==' | base64 -d
marslo