2.4 KiB
2.4 KiB
name, description, disable-model-invocation
| name | description | disable-model-invocation |
|---|---|---|
| regen-sealed-secret | Regenerate a committed *-sealed.yaml SealedSecret from .env values. Use when rotating a secret or when a *-secret.sh script needs to be run to refresh sealed output. | true |
Regenerate the sealed secret for: $ARGUMENTS
This repo keeps sealed secrets and their source script side by side (e.g.
manifests/home-services/discord-bot-secret.sh →
manifests/home-services/discord-bot-sealed.yaml,
manifests/media/immich-postgres-secret.sh →
manifests/media/immich-postgres-sealed.yaml). The script is the source of
truth; the *-sealed.yaml file is generated output.
Steps
- Find the matching
*-secret.shscript for the target secret (searchmanifests/**/*-secret.sh). If none exists yet, model the new one onmanifests/home-services/discord-bot-secret.sh:source "$(dirname "$0")/../../.env" kubectl create secret generic <name> \ --namespace=<namespace> \ --from-literal=<KEY>="${ENV_VAR}" \ --dry-run=client -o yaml \ | kubeseal --controller-namespace=kube-system \ --controller-name=sealed-secrets-controller \ --format=yaml \ > "$(dirname "$0")/<name>-sealed.yaml" - Confirm the source value is up to date in
.env(copy from.env.exampleif the key is missing, then ask the user to fill it in — never invent a secret value). - Confirm
kubesealcan reach the cluster's controller:kubeseal --controller-namespace=kube-system --controller-name=sealed-secrets-controller --fetch-certshould succeed against the live cluster (minisforum, contextdefault). - Run the script:
bash manifests/<area>/<name>-secret.sh. - Diff the resulting
*-sealed.yaml— it should be the only file that changed, and it should NOT contain plaintext (sealed secrets are ciphertext underspec.encryptedData, unlike the rawkubectl create secret ... -o yamloutput piped into it). - Commit only the regenerated
*-sealed.yaml. Never commit the rawkubectl create secret --dry-run=client -o yamloutput or.envitself.
If the secret should instead be created directly in-cluster without being
committed (the runtime-script pattern, e.g. authentik-secret.sh), skip
kubeseal entirely and pipe straight to kubectl apply -f - — don't
sealed-secret something that was never meant to be committed.