k8sec
manages Kubernetes secrets from the command line
TLDR
List all secrets with decoded values
$ k8sec list
Show the keys and values of one secret$ k8sec list [secret-name]
Show values base64-encoded$ k8sec list --base64 [secret-name]
Set one or more keys in a secret$ k8sec set [secret-name] [key1=value1] [key2=value2]
Remove keys from a secret$ k8sec unset [secret-name] [key1] [key2]
Load keys from a dotenv file$ k8sec load -f [.env] [secret-name]
Dump a secret as a dotenv file$ k8sec dump -f [.env] [secret-name]
Work in a specific namespace and context$ k8sec list -n [namespace] --context [context]
SYNOPSIS
k8sec command [options] [arguments]
DESCRIPTION
k8sec manages Kubernetes secrets from the command line. It shows secret values decoded from base64 and lets you set, unset, import and export keys without writing YAML manifests.The load and dump commands convert between secrets and dotenv files, which is handy for syncing application environment variables with a cluster.
PARAMETERS
-n, --namespace NAMESPACE
Kubernetes namespace (default: default).--context CONTEXT
Kubernetes context to use.--kubeconfig PATH
Path to kubeconfig (default: ~/.kube/config).-h, --help
Display help information.
COMMANDS
list [--base64] [NAME]
List secrets with their keys and decoded values.set [--base64] NAME KEY=VALUE...
Set keys in a secret. With --base64, values are taken as already base64-encoded.unset NAME KEY...
Remove keys from a secret.load [-f FILE] NAME
Load keys from dotenv (key=value) text, read from a file or stdin.dump [-f FILE] [--noquotes] [NAME]
Print secrets in dotenv format, optionally to a file and without quotes around values.
CAVEATS
Requires a working kubeconfig and RBAC permissions to read and modify secrets. Secrets are only base64-encoded, not encrypted, unless encryption at rest is enabled in the cluster. Dumped files contain plaintext credentials.
HISTORY
k8sec was written in Go by dtan4 to make Kubernetes secret management easier than raw kubectl commands.
