You have created a secret, and would like to retrieve it.

Get a list of all the secrets in Kubernetes

1
kubectl get secrets

This will result in:

1
2
NAME                  TYPE                                  DATA      AGE
admin-user-pass       Opaque                                2         11s

How to view a secret in Kubernetes

Now that we have our secret’s name, we can view it directly

1
kubectl describe secrets/admin-user-pass

With the following output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Name:            admin-user-pass
Namespace:       default
Labels:          <none>
Annotations:     <none>

Type:            Opaque

Data
====
password:    12 bytes
username:    5 bytes