25 December 2023
tags:
k8s
yaml
yml
*checks dates* So... took a while to write this one? I am going to chalk it to being busy at my jobby job.
According to the official documentation, k8s secrets needs to be base64 encoded.
So below is a no no:
# do **NOT** do this!
apiVersion: v1
kind: Secret
metadata:
name: my-secret
type: Opaque
data:
FAV_FOOD: PIE
Of course, linux comes with base64
utilities, and if you do:
echo "pie" | base64 # prints cGllCg==
... and tried ...
# do **NOT** do this!
apiVersion: v1
kind: Secret
metadata:
name: my-secret
type: Opaque
data:
FAV_FOOD: cGllCg==
You might be in for a rude awakening, too, since this includes a new line character.
Lastly, I tried ...
echo -n "pie" | base64 # prints cGll
So ...
apiVersion: v1
kind: Secret
metadata:
name: my-secret
type: Opaque
data:
FAV_FOOD: cGll
... should work.
- Previous: Bitshift chaos in JS & Python
- Next: FOSDEM2024 day 1