The External Secrets Enterprise 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
: Specifiesinit
mode.--namespace=my-ns
:esi-cli
looks forExternalSecret
resources in themy-ns
namespace.--external-secrets=my-app-es
: All data from the Kubernetes Secret managed bymy-app-es
will be available as environment variables (e.g., ifmy-app-es
has a keydb-host
,DB_HOST
will be set).--inject-on-env=API_USER=backend-secret.username,API_PASS=backend-secret.password
:- The value of the
username
key from thebackend-secret
ExternalSecret’s data will be set as theAPI_USER
environment variable. - The value of the
password
key frombackend-secret
will 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 theconfig
key from theapp-config-es
ExternalSecret’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-cli
will 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 ExternalSecret
s (if not in federation mode) and refresh the files, with a fallback refresh interval of 5 minutes.
Command:
--mode=daemon
: Specifiesdaemon
mode.esi-cli
will run as a long-lived process.--namespace=processing
:esi-cli
looks forExternalSecret
resources in theprocessing
namespace.--inject-on-file=/data/worker.conf=worker-config-es.confKey,/etc/certs/all.yaml=shared-certs-es
:- The value of
confKey
fromworker-config-es
is written to/data/worker.conf
. - All data from
shared-certs-es
is written as a YAML file to/etc/certs/all.yaml
. esi-cli
will monitor the sourceExternalSecret
s 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.