Skip to main content

A kubeseal companion CLI - decrypt, export, and encrypt Kubernetes Secrets with automatic binary management

Project description

kseal

PyPI Python License Tests

A kubeseal companion CLI for viewing, exporting, encrypting, and offline decrypting Kubernetes Secrets.

Installation

pipx install kseal
Other installation methods

With uv:

uv tool install kseal

With pip:

pip install kseal

Requirements

  • Python 3.12+
  • Kubernetes cluster access (not required for offline decryption)
  • Sealed Secrets controller installed in cluster

Quick Start

# View a decrypted secret (requires cluster access)
kseal cat secrets/app.yaml

# Export all secrets to files
kseal export --all

# Encrypt a plaintext secret
kseal encrypt secret.yaml -o sealed.yaml

# Offline decryption (no cluster access needed)
kseal export-keys                              # Backup keys while you have access
kseal decrypt sealed.yaml                      # Decrypt using local keys
kseal decrypt-all --in-place                   # Decrypt all SealedSecrets

Commands

kseal cat

View decrypted secret contents with syntax highlighting.

kseal cat path/to/sealed-secret.yaml
kseal cat sealed.yaml --no-color

kseal export

Export decrypted secrets to files.

# Single file
kseal export sealed.yaml
kseal export sealed.yaml -o output.yaml

# All local SealedSecrets
kseal export --all

# All secrets from cluster
kseal export --all --from-cluster

Default output: .unsealed/<original-path> or .unsealed/<namespace>/<name>.yaml

kseal encrypt

Encrypt plaintext secrets using kubeseal.

# To stdout
kseal encrypt secret.yaml

# To file
kseal encrypt secret.yaml -o sealed.yaml

# Replace original file
kseal encrypt secret.yaml --in-place

kseal export-keys

Export sealed-secrets private keys from cluster for offline decryption.

# Export to default location
kseal export-keys                      # → .kseal-keys/

# Custom output directory
kseal export-keys -o ./backup

# From different namespace
kseal export-keys -n kube-system

kseal decrypt

Decrypt a SealedSecret using local private keys (no cluster access needed).

# Using keys from default location
kseal decrypt sealed.yaml

# Using specific key file
kseal decrypt sealed.yaml --private-key ./key.pem

# From stdin
cat sealed.yaml | kseal decrypt

# Filter keys by pattern
kseal decrypt sealed.yaml --private-keys-regex "2025"

kseal decrypt-all

Decrypt all SealedSecrets in a directory using local private keys.

# Search current directory, output to stdout
kseal decrypt-all

# Search specific directory
kseal decrypt-all ./manifests

# Replace files in-place
kseal decrypt-all --in-place

# Custom keys location
kseal decrypt-all --private-keys-path ./backup

kseal init

Create a configuration file with the latest kubeseal version pinned.

kseal init
kseal init --force  # Overwrite existing

kseal version

Manage kubeseal binary versions.

# List downloaded versions
kseal version list

# Download the latest version
kseal version update

# Set global default version
kseal version set 0.27.0

# Clear default (use highest downloaded)
kseal version set --clear

Configuration

Configuration priority: Environment variables > .kseal-config.yaml > Global settings

Option Environment Variable Default
version KSEAL_VERSION Global default or highest downloaded
controller_name KSEAL_CONTROLLER_NAME sealed-secrets
controller_namespace KSEAL_CONTROLLER_NAMESPACE sealed-secrets
unsealed_dir KSEAL_UNSEALED_DIR .unsealed
Example config file
# .kseal-config.yaml
version: "0.27.0"
controller_name: sealed-secrets
controller_namespace: kube-system
unsealed_dir: .secrets

Version Management

kseal automatically manages kubeseal binary versions:

  • Binaries are stored at ~/.local/share/kseal/kubeseal-<version>
  • Each project can pin a specific version in .kseal-config.yaml
  • Global settings are stored in ~/.local/share/kseal/settings.yaml

Version resolution order:

  1. Project config version (.kseal-config.yaml)
  2. Global default version (kseal version set)
  3. Highest downloaded version
  4. Fetch latest from GitHub (first run only)

Security

  • Add .unsealed/ and .kseal-keys/ to your .gitignore
  • Never commit plaintext secrets or private keys to version control
  • Store exported keys securely (e.g., password manager, encrypted backup)
  • Offline decryption with kseal decrypt requires the private keys - keep them safe

Contributing

git clone https://github.com/eznix86/kseal.git
cd kseal
uv sync

# Run tests
make test

# Run linter
make lint

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kseal-2.0.1.tar.gz (67.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kseal-2.0.1-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file kseal-2.0.1.tar.gz.

File metadata

  • Download URL: kseal-2.0.1.tar.gz
  • Upload date:
  • Size: 67.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kseal-2.0.1.tar.gz
Algorithm Hash digest
SHA256 93faed9a42c1a105f93718bb956d994d6a91909a9c23c3d762bc856107bafcc3
MD5 94dc4a3450764dae8db75e48e624d3ca
BLAKE2b-256 3a0115ce4b7aa6e60aad7b0c58c414ae3ea966bc8fac46e1de46735a6d9bfc4c

See more details on using hashes here.

File details

Details for the file kseal-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: kseal-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kseal-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 851430b2b727bb9d14bdc1f311c1cd9532fbac9adba62e96cdf69b0e10a81a06
MD5 85439c769943c185ba98f7c86ac07cb7
BLAKE2b-256 56c2a1d0afd40739690e3e1759250f8b464fd4ffdd72ea1a0f4495e3583e2aa2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page