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 comment