Jeff Cloud Systems Arcitect with a focus on Kuberetes
1 min read

Kubernetes Admin Toolbox

Kubernetes Admin Toolbox

My k8s Admin Toolbox

Just a set of tools that use while managing my k8s clusters. If you use something different, great, leave a message below.


Get Secrets
#! /bin/bash

# Call with no params: get list of all secrets
# Call with param secret_name: show keys and decoded contents of that specific secret
# Call with params secret_name key_name: show decoded content of that specific key in that specific secret

if [ $# -eq 0 ]; then
  kubectl get secret;
elif [ $# -eq 1 ]; then
  if [ "$1" = "-h" -o "$1" = "--help" -o $# -gt 3 ]; then
    echo "$0 {secret} [key]";
    kubectl get secret $1 -o yaml |
    sed -n '/^data:/,/^kind:/p' | sed '1d;$d' |
    (IFS=":"; while read key val; do echo -n "${key}: "; $0 $1 $key; done);
elif [ $# -eq 2 ]; then
  SECRET="$1"; KEY="$2";
  kubectl get secret ${SECRET} -o yaml | grep ${KEY}: | awk '{ print $2 }' | base64 --decode ; echo "" ;


Here is my ~/.bash_profile

alias k="kubectl"
## Add the from the scripts section
alias gs=~/scripts/

3rd Party

Adds the current cluster/context to you shell prompt