A kubectl plugin that decodes base64-encoded values in Kubernetes secrets, making them easily readable.
- 🔓 Decode all secret values with a single command
- 📋 Multiple output formats: JSON, YAML, and table
- 🎯 Namespace and context support
- 📝 Helpful error messages with secret listing
- ✅ Dependency validation on startup
- kubectl - Kubernetes command-line tool (installation guide)
- jq - JSON processor (installation guide)
- yq (optional) - For better YAML formatting (installation guide)
- Download or clone this repository
- Make the script executable:
chmod +x kubectl-decode
- Move it to a directory in your PATH:
mv kubectl-decode /usr/local/bin/ # or mv kubectl-decode ~/bin/
Once published to the Krew plugin index:
kubectl krew install decodeSee KREW_DISTRIBUTION.md for information on publishing to Krew.
Decode a secret in the current namespace:
kubectl decode my-secretJSON format (default):
kubectl decode docker-registry
# or explicitly
kubectl decode docker-registry -o jsonOutput:
{
".dockerconfigjson": "{\n \"auths\": {\n \"docker.io\": {\n \"auth\": \"dXNlcjpwYXNz\"\n }\n }\n}"
}YAML format:
kubectl decode my-secret -o yamlTable format (human-readable):
kubectl decode my-secret -o tableOutput:
KEY VALUE
--- -----
username admin
password super-secret-password
database production-db
Specify namespace:
kubectl decode my-secret -n kube-system
kubectl decode my-secret --namespace productionSpecify context:
kubectl decode my-secret --context staging-clusterCombine flags:
kubectl decode my-secret -n dev --context staging -o tableShow help:
kubectl decode --helpShow version:
kubectl decode versionShow current KUBECONFIG:
kubectl decode configIf you don't specify a secret name, the plugin will show available secrets:
$ kubectl decode
Error: Missing name of secret
Run 'kubectl decode --help' for usage information
Available secrets:
NAME TYPE DATA AGE
docker-registry kubernetes.io/dockerconfigjson 1 5d
my-secret Opaque 3 2dBased on the kubectl plugin documentation