Understand the init and daemon modes of esi-cli.
esi-cli
operates in one of two primary modes, specified by the mandatory --mode
flag. Each mode is tailored for different use cases in managing and injecting secrets into your applications.
init
Mode (--mode=init
)--external-secrets
, --inject-on-env
, --inject-on-file
, and federation flags.--external-secrets
or --inject-on-env
are used, esi-cli
populates the environment with the fetched secret data.--inject-on-file
is used, esi-cli
writes secret data to the specified file paths.init
mode is that it executes another application binary after setting up the environment. This is specified by the --binary-path
flag. Any arguments for the application can be passed via the --args
flag.esi-cli
in init
mode is short-lived. Once it fetches secrets, injects them, and executes the target binary, its job is done.ExternalSecret
manifest:
esi-cli
to render these env vars via:
--binary-path
flag is required when using --mode=init
.daemon
Mode (--mode=daemon
)--inject-on-file
and federation flags.daemon
mode. Secrets are written to the specified file paths.init
mode, esi-cli
in daemon
mode runs as a long-lived process. It does not execute another binary.ExternalSecret
resources in the same cluster (i.e., not using federation), esi-cli
can watch for changes to these ExternalSecret
resources. If a change is detected, it re-fetches the secrets and updates the target files.--daemon-refresh-interval
(defaulting to 2 minutes), to periodically re-fetch secrets and update files. This is the primary refresh mechanism when using ESI Federation and also serves as a fallback resync mechanism in local mode.ExternalSecret
or a federated ESI server).
Example Invocation Snippet
Suppose you have two ExternalSecrets
like this:
esi-cli
to render these via:
esi-cli
in daemon
mode should be capable of detecting changes to these files and reloading their configuration if they need to pick up updated secret values dynamically.esi-cli
to manage secrets for your applications. Choose the mode that best fits your application’s architecture and secret consumption patterns.