How to decode secrets in k8s?

Check how the data is stored by:

$ kubectl describe secret <secret-name> -n <namespace> 

Now, use the value under Data that you want to decode. Assuming that it is encoded using base64 (default behaviour), you can check the value by:

$ kubectl get secret <secret-name> -n <namespace> -o jsonpath='{.data.<field-name-under-data>}’ | base64 –decode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s