55[ ![ License] ( https://img.shields.io/github/license/eznix86/kseal )] ( LICENSE )
66[ ![ Tests] ( https://github.com/eznix86/kseal/actions/workflows/test.yml/badge.svg )] ( https://github.com/eznix86/kseal/actions/workflows/test.yml )
77
8- A kubeseal companion CLI - view, export, and encrypt Kubernetes SealedSecrets.
9-
10- ## Features
11-
12- ``` bash
13- # View decrypted secret from cluster
14- kseal cat secrets/app-secret.yaml
15- ```
16-
17- ``` yaml
18- apiVersion : v1
19- kind : Secret
20- metadata :
21- name : app-secret
22- namespace : production
23- stringData :
24- DATABASE_URL : postgres://user:pass@localhost/db
25- API_KEY : sk-1234567890
26- ` ` `
27-
28- ` ` ` bash
29- # Export all SealedSecrets to plaintext files
30- kseal export --all
31- ```
32-
33- ``` bash
34- # Encrypt a plaintext Secret
35- kseal encrypt secret.yaml -o sealed-secret.yaml
36- ```
37-
38- ## Key Features
39-
40- - ** View secrets** - Decrypt SealedSecrets by fetching actual values from cluster
41- - ** Export secrets** - Bulk export all SealedSecrets to plaintext files
42- - ** Encrypt secrets** - Convert plaintext Secrets to SealedSecrets using kubeseal
43- - ** Auto-managed binary** - Automatically downloads and manages kubeseal binary
44- - ** Syntax highlighting** - Colored YAML output in terminal
8+ A kubeseal companion CLI for viewing, exporting, and encrypting Kubernetes SealedSecrets.
459
4610## Installation
4711
4812``` bash
4913pipx install kseal
5014```
5115
52- Or with [ uv] ( https://github.com/astral-sh/uv ) :
16+ <details >
17+ <summary >Other installation methods</summary >
18+
19+ With [ uv] ( https://github.com/astral-sh/uv ) :
5320
5421``` bash
5522uv tool install kseal
5623```
5724
58- Or with pip:
25+ With pip:
5926
6027``` bash
6128pip install kseal
6229```
6330
31+ </details >
32+
6433### Requirements
6534
6635- Python 3.12+
67- - Access to a Kubernetes cluster (for decrypt/export operations)
36+ - Kubernetes cluster access
6837- Sealed Secrets controller installed in cluster
6938
70- ## Usage
39+ ## Quick Start
7140
72- ### View a decrypted secret
41+ ``` bash
42+ # View a decrypted secret
43+ kseal cat secrets/app.yaml
44+
45+ # Export all secrets to files
46+ kseal export --all
47+
48+ # Encrypt a plaintext secret
49+ kseal encrypt secret.yaml -o sealed.yaml
50+ ```
51+
52+ ## Commands
53+
54+ ### ` kseal cat `
55+
56+ View decrypted secret contents with syntax highlighting.
7357
7458``` bash
7559kseal cat path/to/sealed-secret.yaml
60+ kseal cat sealed.yaml --no-color
7661```
7762
78- Reads the SealedSecret file, fetches the actual Secret from the cluster, and displays the decrypted values with syntax highlighting.
63+ ### ` kseal export `
7964
80- ### Export secrets
65+ Export decrypted secrets to files.
8166
8267``` bash
83- # Export single file
84- kseal export sealed-secret.yaml
68+ # Single file
69+ kseal export sealed.yaml
70+ kseal export sealed.yaml -o output.yaml
8571
86- # Export to specific location
87- kseal export sealed-secret.yaml -o decrypted.yaml
88-
89- # Export all SealedSecrets recursively (from local files)
72+ # All local SealedSecrets
9073kseal export --all
9174
92- # Export all SealedSecrets directly from cluster
75+ # All secrets from cluster
9376kseal export --all --from-cluster
9477```
9578
96- Exported files are saved to ` .unsealed/ ` by default. When using ` --from-cluster ` , files are organized as ` .unsealed/<namespace>/<name>.yaml ` .
79+ Default output: ` .unsealed/<original-path> ` or ` .unsealed/<namespace>/<name>.yaml `
80+
81+ ### ` kseal encrypt `
9782
98- ### Encrypt a secret
83+ Encrypt plaintext secrets using kubeseal.
9984
10085``` bash
101- # Output to stdout
86+ # To stdout
10287kseal encrypt secret.yaml
10388
104- # Save to file
105- kseal encrypt secret.yaml -o sealed-secret .yaml
89+ # To file
90+ kseal encrypt secret.yaml -o sealed.yaml
10691
107- # Replace original file
92+ # Replace original
10893kseal encrypt secret.yaml --replace
10994```
11095
111- ### Initialize configuration
96+ ### ` kseal init `
97+
98+ Create a configuration file.
11299
113100``` bash
114101kseal init
102+ kseal init --force # Overwrite existing
115103```
116104
117- Creates ` .kseal-config.yaml ` with default settings.
118-
119105## Configuration
120106
121- Configuration is loaded from (in priority order):
107+ Configuration priority: Environment variables > ` .kseal-config.yaml ` > Defaults
122108
123- 1 . Environment variables
124- 2 . ` .kseal-config.yaml ` in current directory
125- 3 . Default values
109+ | Option | Environment Variable | Default |
110+ | --------| ---------------------| ---------|
111+ | ` kubeseal_path ` | ` KSEAL_KUBESEAL_PATH ` | ` ~/.local/share/kseal/kubeseal ` |
112+ | ` version ` | ` KSEAL_VERSION ` | ` latest ` |
113+ | ` controller_name ` | ` KSEAL_CONTROLLER_NAME ` | ` sealed-secrets ` |
114+ | ` controller_namespace ` | ` KSEAL_CONTROLLER_NAMESPACE ` | ` sealed-secrets ` |
115+ | ` unsealed_dir ` | ` KSEAL_UNSEALED_DIR ` | ` .unsealed ` |
126116
127- | Option | Env Variable | Default | Description |
128- | --------| --------------| ---------| -------------|
129- | ` kubeseal_path ` | ` KSEAL_KUBESEAL_PATH ` | ` ~/.local/share/kseal/kubeseal ` | Path to kubeseal binary |
130- | ` version ` | ` KSEAL_VERSION ` | ` latest ` | Kubeseal version to download |
131- | ` controller_name ` | ` KSEAL_CONTROLLER_NAME ` | ` sealed-secrets ` | Sealed Secrets controller name |
132- | ` controller_namespace ` | ` KSEAL_CONTROLLER_NAMESPACE ` | ` sealed-secrets ` | Controller namespace |
133- | ` unsealed_dir ` | ` KSEAL_UNSEALED_DIR ` | ` .unsealed ` | Directory for exported secrets |
134-
135- ### Example config file
117+ <details >
118+ <summary >Example config file</summary >
136119
137120``` yaml
138121# .kseal-config.yaml
@@ -143,29 +126,17 @@ controller_namespace: kube-system
143126unsealed_dir : .secrets
144127` ` `
145128
146- ## Commands
147-
148- | Command | Description |
149- |---------|-------------|
150- | ` kseal cat <file>` | View decrypted secret contents |
151- | `kseal export <file>` | Export decrypted secret to file |
152- | `kseal export --all` | Export all SealedSecrets recursively from local files |
153- | `kseal export --all --from-cluster` | Export all SealedSecrets directly from cluster |
154- | `kseal encrypt <file>` | Encrypt plaintext Secret to SealedSecret |
155- | `kseal init` | Create configuration file |
129+ </details>
156130
157131## Security
158132
159- - Exported plaintext secrets are saved to `.unsealed/` which should be in your `.gitignore`
133+ - Add ` .unsealed/` to your `.gitignore`
160134- Never commit plaintext secrets to version control
161- - The tool requires access to your Kubernetes cluster to decrypt secrets
135+ - Requires cluster access to decrypt secrets
162136
163137# # Contributing
164138
165- Contributions are welcome! Please feel free to submit a Pull Request.
166-
167139` ` ` bash
168- # Clone and install dev dependencies
169140git clone https://github.com/eznix86/kseal.git
170141cd kseal
171142uv sync
@@ -179,4 +150,4 @@ make lint
179150
180151# # License
181152
182- MIT License - see [LICENSE ](LICENSE) for details.
153+ [MIT ](LICENSE)
0 commit comments