feat: implement pod-specific secret injection for DaemonSets with automated lifecycle management

This commit is contained in:
Pengzhan Hao
2026-01-21 07:00:48 +00:00
commit cffe13168f
15 changed files with 973 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
# Secret Manager
A simple CLI tool to manage Kubernetes Secrets from your local machine. It handles Base64 encoding/decoding automatically, allowing you to work with plain text values.
## Features
- **List**: View all keys and values in a secret (decoded).
- **Add/Update**: Add a new key-value pair or update an existing one using plain text.
- **Delete**: Remove a specific key from a secret.
## Prerequisites
- Local `kubeconfig` file (usually at `~/.kube/config`).
- `cluster-admin` or sufficient RBAC permissions to manage secrets in the target namespace.
## Build
From the root of the repository:
```bash
make build
# The binary will be located at bin/secret-manager
```
## Usage
```bash
./bin/secret-manager --secret <name> [options]
```
### Options
- `--namespace`: Namespace of the secret (default: `default`).
- `--secret`: **(Required)** Name of the Kubernetes secret.
- `--op`: Operation to perform: `list`, `add`, or `delete` (default: `list`).
- `--key`: The key to add or delete.
- `--value`: The plain text value to add (required for `add` operation).
- `--kubeconfig`: Path to a custom kubeconfig file.
### Examples
**1. List keys and values:**
```bash
./bin/secret-manager --namespace gps-system --secret test-daemonset-7v1v1 --op list
```
**2. Add or update a key:**
```bash
./bin/secret-manager --namespace gps-system --secret test-daemonset-7v1v1 --op add --key my-key --value "my-value"
```
**3. Delete a key:**
```bash
./bin/secret-manager --namespace gps-system --secret test-daemonset-7v1v1 --op delete --key my-key
```