-
Kubernetes secrets to a dotenv (.env) file
For dumb reasons, I recently needed to be able to quickly setup a local environment with secrets loaded from a kubernetes instance. After manually copying/pasting/decoding a few times, I decided to write a quick script to do it for me.
The following script grabs a kubernetes secrets file (
${SECRET}
) from kube, decodes each key/value pair and then appends them to a.env
file.Prerequisites: jq, kubectl
The above script invokes
jq
twice, which was a quick and dirty workaround to get it working under alpineās ash, in addition to bash.