Configure ESI Pod Webhook behavior using pod annotations to inject secrets.
metadata
section of your Pods. These annotations instruct the webhook on how and what secrets to inject.
secretless.externalsecrets.com/
.externalsecret
secretless.externalsecrets.com/externalsecret: "<your-externalsecret-name>"
ExternalSecret
resource from which to fetch secrets. This ExternalSecret
must exist in the same namespace as the Pod being annotated.env-vars
secretless.externalsecrets.com/env-vars: "true" | "false"
"false"
(if not specified)"true"
, the webhook injects an init container into the Pod. This init container runs esi-cli --mode=init
, which fetches secrets from the specified ExternalSecret
, exports them as environment variables, and then executes your application container’s original command.my-db-password
becomes MY_DB_PASSWORD
). Refer to the esi-cli
documentation for precise conversion rules.file-secrets
secretless.externalsecrets.com/file-secrets: "true" | "false"
"false"
(if not specified)"true"
, the webhook injects a sidecar container into the Pod. This sidecar runs esi-cli --mode=daemon
.esi-cli
fetches secrets from the ExternalSecret
and writes them to a single file: /secrets/secrets.json
(in JSON format). This file is located in an in-memory volume shared with your application container(s)./secrets
./secrets/secrets.json
) are currently fixed and not customizable via annotations.ExternalSecret
changes. Your application would need to be capable of reloading configuration from this file if it needs to pick up changes dynamically.env-vars
and file-secrets
simultaneously if needed, though this is less common. If both are true, an init container will inject environment variables, AND a sidecar will provide /secrets/secrets.json
.skip
secretless.externalsecrets.com/skip: "true" | "false"
"false"
(if not specified)"true"
, the ESI Pod Webhook will ignore this Pod entirely, and no inspection or injection will occur. This is useful for:
skip: "true"
by default).image-pull-secrets
secretless.externalsecrets.com/image-pull-secrets: "<your-image-pull-secret-name>"
Secret
of type kubernetes.io/dockerconfigjson
(an image pull secret) to be added to the Pod’s spec.imagePullSecrets
array. This is useful if the esi-cli
init or sidecar container images (which are configured globally for the webhook deployment) are hosted in a private container registry that requires authentication.esi-cli
Passthrough Annotationsesi-cli
tool when it’s run by the init container (i.e., for environment variable injection). They provide finer-grained control over esi-cli
’s behavior, especially for features like federation.
secretless.externalsecrets.com/env-vars: "true"
is also specified. They are not used by the sidecar container in file-secrets
mode.federated-server-url
secretless.externalsecrets.com/federated-server-url: "<url_of_federation_server>"
esi-cli
flag: --federated-server-url
env-vars: "true"
.inject-on-env
(Passthrough for esi-cli
)secretless.externalsecrets.com/inject-on-env: "<env_map_string_for_esi_cli>"
esi-cli
flag: --inject-on-env
esi-cli
to control how secrets are named or selected when injected as environment variables. The format of <env_map_string_for_esi_cli>
is determined by esi-cli
’s own parsing rules (e.g., ENV_VAR_NAME=secretKey,OTHER_VAR=anotherKey
).
secretless.externalsecrets.com/env-vars: "true"
enables general environment variable injection (all keys from the ExternalSecret
’s data), this annotation allows for more precise control via esi-cli
’s --inject-on-env
flag, potentially overriding or refining the default behavior.env-vars: "true"
.federated-generator
secretless.externalsecrets.com/federated-generator: "<generator_config_string_for_esi_cli>"
esi-cli
flag: --federated-generators
esi-cli
when fetching secrets from a federated ESI server.env-vars: "true"
and likely federated-server-url
.federated-store
secretless.externalsecrets.com/federated-store: "<store_config_string_for_esi_cli>"
esi-cli
flag: --federated-store
esi-cli
when fetching secrets from a federated ESI server.env-vars: "true"
and likely federated-server-url
.esi-cli
flags (--federated-server-url
, --inject-on-env
, --federated-generators
, --federated-store
), please consult the ESI-CLI documentation.Deployment
itself accepts arguments that globally configure the behavior of injected containers. These are set once when deploying the webhook:
--tls-cert=<path>
: Path to the webhook’s TLS certificate file (default: /etc/webhook/certs/tls.crt
).--tls-key=<path>
: Path to the webhook’s TLS private key file (default: /etc/webhook/certs/tls.key
).--port=<port>
: Port for the webhook server (default: 8443
).--init-image=<image_uri>
: The container image to use for the init container (e.g., your-registry/esi-cli:latest
).--sidecar-image=<image_uri>
: The container image to use for the sidecar container (e.g., your-registry/esi-cli:latest
).--image-pull-policy=<policy>
: Image pull policy (e.g., IfNotPresent
, Always
) for injected containers.