The External Secrets Enterprise Edition is product suite is a premium product.
It requires a specific subscription. Contact us for more information.
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)
This mode is designed for scenarios where secrets must be available as environment variables or files before an application’s main process starts. It’s commonly used within a Kubernetes init container.
Key Behaviors & Characteristics:
- Secret Fetching: Retrieves secrets based on the configurations provided by flags like --external-secrets,--inject-on-env,--inject-on-file, and federation flags.
- Environment Variable Injection: If --external-secretsor--inject-on-envare used,esi-clipopulates the environment with the fetched secret data.
- File Injection: If --inject-on-fileis used,esi-cliwrites secret data to the specified file paths.
- Application Execution: A crucial aspect of initmode is that it executes another application binary after setting up the environment. This is specified by the--binary-pathflag. Any arguments for the application can be passed via the--argsflag.
- Lifecycle: esi-cliininitmode 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:
The 
--binary-path flag is required when using --mode=init.daemon Mode (--mode=daemon)
This mode is designed for scenarios where secrets need to be available as files and potentially refreshed while an application is running. It’s commonly used within a Kubernetes sidecar container.
Key Behaviors & Characteristics:
- Secret Fetching: Retrieves secrets primarily for file injection, configured via --inject-on-fileand federation flags.
- File Injection: This is the main focus of daemonmode. Secrets are written to the specified file paths.
- Long-Lived Process: Unlike initmode,esi-cliindaemonmode runs as a long-lived process. It does not execute another binary.
- Secret Refreshing & Watching:
- Local Kubernetes Mode: When fetching secrets directly from ExternalSecretresources in the same cluster (i.e., not using federation),esi-clican watch for changes to theseExternalSecretresources. If a change is detected, it re-fetches the secrets and updates the target files.
- Federation Mode / Fallback: It uses a periodic refresh interval, defined by --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.
 
- Local Kubernetes Mode: When fetching secrets directly from 
ExternalSecret or a federated ESI server).
Example Invocation Snippet
Suppose you have two ExternalSecrets like this:
esi-cli to render these via:
Applications consuming files written by 
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.