Skip to content

Instantly share code, notes, and snippets.

@asjadathick
Created October 14, 2019 13:24
Show Gist options
  • Select an option

  • Save asjadathick/ec2fbaf0fd41525c4ee20dc2f50b3c9b to your computer and use it in GitHub Desktop.

Select an option

Save asjadathick/ec2fbaf0fd41525c4ee20dc2f50b3c9b to your computer and use it in GitHub Desktop.
Bash script to generate a secret manifest for k8s secrets. Everything in ./CREDS/ gets picked as a credential
#!/bin/bash
#removes secrets manifest file if already available
rm secrets.yaml
echo "
apiVersion: v1
kind: Secret
metadata:
name: metricbeat-secrets
data:" >> secrets.yaml
for file in CREDS/*; do
if [ -f "$file" ]; then
name=${file#CREDS/}
echo " $name: \"$(cat $file | base64)\"" >> secrets.yaml
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment