Created
October 22, 2021 09:00
-
-
Save torsak/f4ed8c3b9980ecb547952f64773113f1 to your computer and use it in GitHub Desktop.
k8s reveal secret
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $3 ] | |
then | |
kubectl get secret/$1 -n $3 -o jsonpath="{.data.$2}" | base64 -d | |
else | |
kubectl get secret/$1 -o jsonpath="{.data.$2}" | base64 -d | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +x ksecret
.~/bin
.PATH=~/bin:$PATH
.Usage:
ksecret <secret-name> <data-name> <namespace-optional>
Example:
ksecret database-credentials POSTGRES_PASSWORD
or with a specific namespace.
ksecret database-credentials POSTGRES_PASSWORD release