<p>I'm trying to encode a database string using base64 on the command line in linux.</p>
<p>Once I do I add the value to a secret in kubernetes but my application is failing to connect to the database due to the db string not being accepted. There seems to be a newline getting added when I check the value in lens and this is not there in a similar cluster in the same secret</p>
<p>jdbc:postgresql://test.xxxxxxxx.eu-west-2.rds.amazonaws.com/test</p>
<pre><code>deirdre$ echo jdbc:postgresql://test.xxxxxxxx.eu-west-2.rds.amazonaws.com/test | base64 | tr -d &quot;\n&quot;
amRiYzpwb3N0Z3Jlc3FsOi8vdGVzdC54eHh4eHh4eC5ldS13ZXN0LTIucmRzLmFtYXpvbmF3cy5jb20vdGVzdAo=
</code></pre>
<p>Is there something I am doing wrong? or is there an issue with the /?</p>

<p>You can fix those easy with</p>
<pre><code>echo -n &quot;string&quot; | base64
</code></pre>
<p>&quot;echo -n&quot; removes the trailing newline character.</p>
<p>You can also see my last answer i gave to following Question
<a href="https://stackoverflow.com/questions/68032810/kubernetes-secrets-as-environment-variable-add-space-character/68033302#68033302">Kubernetes secrets as environment variable add space character</a></p>
