Skip to content

Instantly share code, notes, and snippets.

@aduzsardi
Created April 26, 2023 15:05
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 aduzsardi/53a38dd1dc341a8e2f872ad28ab7a405 to your computer and use it in GitHub Desktop.
Save aduzsardi/53a38dd1dc341a8e2f872ad28ab7a405 to your computer and use it in GitHub Desktop.
kubectl plugin to base64 decode secrets data
#!/bin/bash
# Install: put this in an executable file named `kubectl-decode_secret` , which is in your PATH
# Usage: kubectl decode-secret <secret-name>
#
# Note: the script is using fzf (https://github.com/junegunn/fzf) , for example if you just type `kubectl decode-secret`
# it will list the screts and you can select whichever you want
kubectl get secret $(kubectl get secret | sed 1d | fzf | awk '{ print $1 }') --template='{{ range $key, $value := .data }}{{ printf "%s: %s\n" $key ($value | base64decode) }}{{ end }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment