Skip to content

Instantly share code, notes, and snippets.

@MarounMaroun
Last active July 22, 2020 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarounMaroun/8e03f29a3c866c7aa8d1c818f10d358f to your computer and use it in GitHub Desktop.
Save MarounMaroun/8e03f29a3c866c7aa8d1c818f10d358f to your computer and use it in GitHub Desktop.
Updating K8s secret
#!/bin/bash
read -rp "What is the new access_key: " access_key
read -rp "What is the new secret_key: " secret_key
enc_access=$(echo "$access_key" | base64)
enc_secret=$(echo "$secret_key" | base64)
echo "encrypted access key: $enc_access"
echo "encrypted secret key: $enc_secret"
kubectl get secret aws-s3-key -o json | jq --arg enc_access "$enc_access" '.data["access_key"]=$enc_access' | kubectl apply -f -
kubectl get secret aws-s3-key -o json | jq --arg enc_secret "$enc_secret" '.data["secret_key"]=$enc_secret' | kubectl apply -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment