base64 encoding Kubernetes Secrets includes newline char when exported as an env variable (if you don’t use -n option with echo)

I’m deploying an app to Kubernetes that references a Kubernetes Secret that is exported as an env var on the pod. I couldn’t work out why I kept getting this error when the pod was starting up:

FATAL: password authentication failed for user "admin"

but if I exec’d into the pod to check the value of the env var, it was the correct value that I expected.

Eventually I did stumble across this clue – ‘printenv’ inside the pod shows:

DB_PASSWORD=[value here]

KUBERNETES_SERVICE_PORT_HTTPS=443
[... other values here]

Between DB_PASSWORD and the next value there’s a blank line, followed by a long list of other env var values, with no other blank lines.

From this question, the issue is how I originally encoded the base64 value with:

echo your-value-here | base64

which is not the same as:

echo -n your-value-here | base64

echo apparently includes a newline by default, so you need to use it as above with the -n option

Raspbian Buster – fixing “The repository ‘http://raspbian.raspberrypi.org/raspbian buster Release’ no longer has a Release file”

I have a number of Raspberry Pis that I tinker with every now and then, but not on a regular basis. On my Pi400 I have Rasbian Buster. I just tried a ‘sudo apt update’ and got this error:

E: The repository 'http://raspbian.raspberrypi.org/raspbian buster Release' no longer has a Release file.

From this post, apparently the apt repos for Buster have changed, so you need to edit /etc/apt/sources.list.d/raspi/list and replace

deb http://archive.raspberrypi.org/debian/ buster main

with

deb https://legacy.raspbian.org/raspbian/ buster main contrib non-free rpi

apt update again and all should be good.