dotfiles/bin/ksecret
2019-04-19 17:19:12 +02:00

12 lines
272 B
Bash
Executable file

#!/bin/bash
set -e
if [ "$#" -lt 2 ]; then
echo "Usage: ${0} [kubectl options] secret key"
exit 0
fi
secret="${@:$(($#-1)):1}"
key="${@:$(($#)):1}"
set -- "${@:1:$(($#-2))}"
kubectl get secret "$@" "${secret}" -o "go-template={{index .data \"${key}\"}}" | base64 -d