The External Secrets Enterprise Edition is product suite is a premium product.
It requires a specific subscription. Contact us for more information.
esi-cli for common use cases. For examples involving ESI Federation, please see the ESI CLI with Federation page.
Example 1: init Mode - Environment Variables and File Injection
Scenario: Before starting an application, inject secrets from the my-app-es ExternalSecret as general environment variables. Additionally, inject specific keys (username and password from backend-secret) as API_USER and API_PASS environment variables, and write a specific configuration key (app-config-es.config) to a file. After setup, execute the /app/server binary with specified arguments.
Command:
- --mode=init: Specifies- initmode.
- --namespace=my-ns:- esi-clilooks for- ExternalSecretresources in the- my-nsnamespace.
- --external-secrets=my-app-es: All data from the Kubernetes Secret managed by- my-app-eswill be available as environment variables (e.g., if- my-app-eshas a key- db-host,- DB_HOSTwill be set).
- --inject-on-env=API_USER=backend-secret.username,API_PASS=backend-secret.password:- The value of the usernamekey from thebackend-secretExternalSecret’s data will be set as theAPI_USERenvironment variable.
- The value of the passwordkey frombackend-secretwill be set asAPI_PASS.
- These specific mappings will override any similarly named variables that might have been set by --external-secrets.
 
- The value of the 
- --inject-on-file=/etc/app/config.json=app-config-es.config: The value of the- configkey from the- app-config-esExternalSecret’s data will be written to the file- /etc/app/config.json. Parent directories will be created if they don’t exist.
- --binary-path=/app/server: After injections,- esi-cliwill execute- /app/server.
- --args="--port=8080,--debug": These arguments will be passed to- /app/server.
Example 2: daemon Mode - File Injection with Refresh
Scenario: Run esi-cli as a sidecar to provide secrets as files. Fetch a specific key (confKey) from worker-config-es and write its content to /data/worker.conf. Also, fetch the entire shared-certs-es secret and write it as a YAML file to /etc/certs/all.yaml. esi-cli will watch for changes to these ExternalSecrets (if not in federation mode) and refresh the files, with a fallback refresh interval of 5 minutes.
Command:
- --mode=daemon: Specifies- daemonmode.- esi-cliwill run as a long-lived process.
- --namespace=processing:- esi-clilooks for- ExternalSecretresources in the- processingnamespace.
- --inject-on-file=/data/worker.conf=worker-config-es.confKey,/etc/certs/all.yaml=shared-certs-es:- The value of confKeyfromworker-config-esis written to/data/worker.conf.
- All data from shared-certs-esis written as a YAML file to/etc/certs/all.yaml.
- esi-cliwill monitor the source- ExternalSecrets for changes and update these files. Parent directories will be created if they don’t exist.
 
- The value of 
- --daemon-refresh-interval=5m: Sets the periodic refresh/resync interval to 5 minutes.
Applications reading files managed by 
esi-cli in daemon mode should be designed to detect file changes and reload their configuration if they need to use updated secret values.esi-cli. You can combine flags as needed to suit your specific secret injection requirements. Always refer to the Command-Line Flags documentation for a complete list of options.