LiteLLM Gateway Operator Reference
This reference covers LiteLLM-specific implementation details of the LiteLLM Gateway Operator. For the AiGateway, AiGatewayClass, ToolGateway, and ToolGatewayClass CRD field tables, see AiGateway and AiGatewayClass Reference and ToolGateway and ToolGatewayClass Reference.
Controller names
The operator registers one controller for each gateway kind:
| Gateway kind | Controller name (spec.controller) |
|---|---|
|
|
|
|
An AiGateway with spec.aiGatewayClassName: litellm is claimed and reconciled by this operator. A ToolGateway with spec.toolGatewayClassName: litellm is claimed and reconciled by this operator.
The shipped litellm AiGatewayClass and ToolGatewayClass are not marked as the cluster default. To claim AiGateway or ToolGateway resources that omit the class name field, add the corresponding is-default-class annotation via a Kustomize overlay:
# kustomization.yaml
resources:
- https://github.com/agentic-layer/ai-gateway-litellm-operator/releases/latest/download/install.yaml
patches:
- patch: |-
apiVersion: runtime.agentic-layer.ai/v1alpha1
kind: AiGatewayClass
metadata:
name: litellm
annotations:
aigatewayclass.kubernetes.io/is-default-class: "true"
- patch: |-
apiVersion: runtime.agentic-layer.ai/v1alpha1
kind: ToolGatewayClass
metadata:
name: litellm
annotations:
toolgatewayclass.kubernetes.io/is-default-class: "true"
Use this only when this operator is the single AI/Tool Gateway implementation in the cluster.
Config-patch annotation
| Item | Value |
|---|---|
Annotation key |
|
Annotation target |
|
Value |
Name of a |
The ConfigMap must contain a key patch.yaml whose value is a partial LiteLLM config fragment. The operator deep-merges this onto the generated config using RFC 7396 map-merge semantics (see Merge semantics).
Config-patch ConfigMap schema
The patch.yaml key in the ConfigMap must contain a YAML document that is a partial LiteLLM config.yaml. Any top-level key supported by LiteLLM can appear here. Common use cases:
| Key | Typical use |
|---|---|
|
Configure routing strategy, Redis-backed usage tracking, fallback models. |
|
Set |
|
Override callbacks, request timeout, or add custom settings not exposed by the CRD. |
|
Add |
Supported LiteLLM features via typed CRD fields
The operator generates these LiteLLM config blocks from typed CRD fields. Use the patch for anything outside this table.
| LiteLLM config block | Source CRD field(s) |
|---|---|
|
|
|
|
|
Always set to |
|
Fixed at |
|
|
Caveats
-
Patching
litellm_settings.callbacksreplaces the operator-generated[otel, prometheus]list. Include both entries if you need to extend rather than replace. -
Patching
model_listreplaces the operator-generated list. PreferAiGateway.spec.aiModelsfor all models. -
Patching
guardrailsreplaces the operator-generated list. Preferspec.guardrailsfor all guards. -
The operator does not validate the patch against LiteLLM’s schema. Misconfiguration surfaces at LiteLLM startup, not in the operator.
Generated ConfigMap name pattern
For each reconciled gateway, the operator creates an operator-owned ConfigMap in the same namespace:
+<gateway-name>-config+
For example, an AiGateway named my-ai-gateway produces a ConfigMap named my-ai-gateway-config. The ConfigMap contains one key:
| Key | Description |
|---|---|
|
Complete LiteLLM configuration, including any applied patch. Mounted at |
LiteLLM container defaults
The operator manages the LiteLLM container in the generated Deployment.
| Item | Value |
|---|---|
Container image |
|
Container name |
|
Container port |
Configured by |
Service port |
Same as container port (ClusterIP). |
Memory request / limit |
|
CPU request / limit |
|
Liveness probe path |
|
Readiness probe path |
|
Config volume mount |
|
Prometheus multiprocess dir |
|
Environment variables
| Variable | Source and behaviour |
|---|---|
|
Injected automatically for each provider listed in |
|
Always injected with value |
Any variable in |
Forwarded verbatim to the container. User-supplied variables win on name conflicts with operator-generated ones (except |
Pod restart annotation
The operator annotates the pod template with a hash of the generated LiteLLM configuration and the api-key-secrets Secret:
runtime.agentic-layer.ai/config-hash: <16-character hex> runtime.agentic-layer.ai/secret-hash: <16-character hex>
When the config or Secret changes, the hash changes and Kubernetes rolls the Deployment automatically.