I'm trying to get secrets with kubectl
with:
kubectl get secrets/postgresql -n my-namespace -o=go-template=='{{index .data "postgresql-password" }}'
it returns the correct value ( I get the same result with lens )
But when I do:
kubectl get secrets/postgresql -n my-namespace -o=go-template=='{{index .data "postgresql-password" }}' | base64 -d
I get:
base64: invalid input
But Lens can decode it easily. What am I doing wrong ?
CodePudding user response:
First check command
kubectl get secrets/postgresql -n my-namespace -o=go-template=='{{index .data "postgresql-password" }}'
if you see base64 string it is good. But also you can see "=" in the start and the end of this string.
Just try this:
kubectl get secrets/postgresql -n my-namespace -o=go-template='{{index .data "postgresql-password" }}' | base64 -d