<p>I'm trying to get secrets with <code>kubectl</code> with:</p>
<pre><code>kubectl get secrets/postgresql -n my-namespace -o=go-template=='{{index .data &quot;postgresql-password&quot; }}'
</code></pre>
<p>it returns the correct value ( I get the same result with lens )</p>
<p>But when I do:</p>
<pre><code>kubectl get secrets/postgresql -n my-namespace -o=go-template=='{{index .data &quot;postgresql-password&quot; }}' | base64 -d
</code></pre>
<p>I get:</p>
<pre><code>base64: invalid input
</code></pre>
<p>But Lens can decode it easily. What am I doing wrong ?</p>

Juliatzin
<p>First check command :</p>
<pre><code>kubectl get secrets/postgresql -n my-namespace -o=go-template=='{{index .data &quot;postgresql-password&quot; }}'
</code></pre>
<p>if you see base64 string it is good. But also you can see &quot;=&quot; in the start and the end of this string.</p>
<p>Just try to run the following :</p>
<pre><code>kubectl get secrets/postgresql -n my-namespace -o=go-template='{{index .data &quot;postgresql-password&quot; }}' | base64 -d
</code></pre>
