Chris Stryczynski

Software Developer / Consultant

Retrieve Kubernetes API secret on minikube with simple Bash script

Here is a simple bash script, you’ll need jq installed.

#!/usr/bin/env bash
key=$(kubectl get serviceaccount default -o json | jq -r '.secrets[].name')
kubectl get secret "$key" -o json | jq -r '.data.token' | base64 -d