Get secret

Summary:

$ kubectl get secrets

Detailed:

$ kubectl get secret SECRET_NAME -o yaml
$ kubectl get secret SECRET_NAME -o json

Create secret

$ kubectl create secret generic SECRET_NAME --from-file=username.txt --from-file=password.txt
$ kubectl create secret generic SECRET_NAME --from-literal=username=foo --from-literal=password='S!B\*d$zDsb'

Edit

$ kubectl edit secrets SECRET_NAME

Dump secrets

Create a YAML file for each secret available.

$ kubectl get --no-headers secret | \
    awk '{print $1}' | \
    xargs -I{} sh -c 'kubectl get secret -o yaml "$1" > "$1.yaml"' - {}