Note to my nerd self (and anyone else who might find this information handy one day): if you run the Unix
env command and there is a blank line in the middle of the output? it means there is a goddamn newline at the end of the value assigned to the variable immediately above. Trying the old
echo $MYENVAR can mislead you even more; it doesn't even print an empty line to
STDOUT or in any other way indicate the presence of the
\n at the end of your assigned value. If this envar happens to be—oh, let's just say,—setting an administrator password in your application container, and you overlook this subtle nonprinting character, this can entirely fuck your shit up, even as far as a full-day-wasting, headdesk-y bout of frustration.
A good way to finally noodle out WTF is going on is to drop into a Python shell and
os.getenv() the offending variable. The result will actually, explicitly, and helpfully show you the
\n at the end of your value, and you will remember to strip that damn thing off before you base64-encode it for your Kubernetes Secret resource definition next time, but trust me: the blank line in the
env output should clue you in, and would be a lot faster and less painful.