kubectl: get specific value from a secret in plaintext

Try this

kubectl get secret foo --template={{.data.bar}} | base64 --decode

No need of jq.


This should work since Kubernetes 1.11 (see PR 60755):

kubectl get secret foo -o go-template='{{ .data.bar | base64decode }}'


kubectl get secret foo -o jsonpath={.data.bar} | base64 --decode

https://kubernetes.io/docs/reference/kubectl/jsonpath/