A kubectl plugin that helps decode Kubernetes secrets in a human-readable format.
kubectl-secret-d is a kubectl plugin that makes it easy to decode and view the contents of Kubernetes secrets. It automatically decodes base64-encoded secret values and presents them in a readable format.
brew tap karpulix/kubectl-plugins
brew install karpulix/kubectl-plugins/kubectl-secret-d- Make the script executable:
chmod +x kubectl-secret_d- Move the script to a directory in your PATH:
sudo mv kubectl-secret_d /usr/local/bin/kubectl-secret_dkubectl secret-d <secret-name> [-n namespace] [-o yaml]<secret-name>: Name of the Kubernetes secret (required)-n, --namespace: Kubernetes namespace (optional)-o, --output: Output format (optional, supports 'yaml')
- Decode a secret in the default namespace:
kubectl secret-d my-secret- Decode a secret in a specific namespace:
kubectl secret-d my-secret -n my-namespace- Get the secret in YAML format:
kubectl secret-d my-secret -o yamlBy default, the plugin displays decoded key-value pairs in the format:
key1: value1
key2: value2
When using the YAML output format (-o yaml), it converts the secret data to a YAML format with stringData instead of base64-encoded data.
- kubectl
- yq (for YAML processing)
- base64 (usually pre-installed on Unix-like systems)
This project is open source and available under the MIT License.