# Deploy and Operate Gateways on Kubernetes

The `api7/aisix` Helm chart deploys, exposes, and scales AISIX gateways in Kubernetes. Gateway listeners, Services, autoscaling, shared Redis, disruption handling, draining, and application settings work the same way whether the gateway receives resources from AISIX Enterprise, AISIX Cloud, or an AISIX OSS resources file. This page begins with the control-plane-connected installation path, then covers those shared Kubernetes operations.

A gateway connected to AISIX Enterprise or AISIX Cloud requires the data-plane manager endpoint and a gateway certificate bundle issued for the target environment. Once connected, it receives models, caller API keys, and policies from the control plane. For AISIX OSS, first [deploy the gateway with a resources file](https://docs.api7.ai/ai-gateway/deployment/open-source-gateway-on-kubernetes.md), then continue here at [Expose the Gateway](#expose-the-gateway).

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

* A Kubernetes cluster with `kubectl` configured to access it and Helm 3 installed.
* For OpenShift or OKD, cURL and an `oc` session that can manage workloads, Services, Secrets, and Routes in the gateway project, read pod logs, and run `oc exec`.
* For the OpenShift or OKD Route examples, the applications domain and ingress CA certificate, or permission to read the cluster Ingress configuration and the `default-ingress-cert` ConfigMap in `openshift-config-managed`. A cluster administrator can supply the domain and CA.
* Access to an AISIX Enterprise or AISIX Cloud environment where you can issue a gateway certificate.
* Network access from the cluster to the AISIX Enterprise or AISIX Cloud data-plane manager endpoint. For AISIX Enterprise, complete [Deploy the AISIX Enterprise Control Plane](https://docs.api7.ai/ai-gateway/on-premises/deployment.md) first.

## Deploy the Gateway[​](#deploy-the-gateway "Direct link to Deploy the Gateway")

In the dashboard, open the target environment's **Data planes** view and issue a gateway certificate. The **Kubernetes (Helm)** tab provides the data-plane manager endpoint and certificate bundle used below. The example also pins the initial deployment to one replica. The private key is shown only once.

On OpenShift or OKD, select or create the `aisix-dp` project with `oc project aisix-dp` or `oc new-project aisix-dp`. Use `oc` in place of `kubectl` in this procedure, and omit the `kubectl create namespace` command below.

Store the bundle in a Secret so the private key stays out of your values file:

```
kubectl create namespace aisix-dp



kubectl -n aisix-dp create secret generic aisix-gateway-certificate \

  --from-file=cert.pem=./cert.pem \

  --from-file=key.pem=./key.pem \

  --from-file=ca.pem=./ca.pem
```

Install the chart against the data-plane manager endpoint from the same view:

```
helm repo add api7 https://charts.api7.ai

helm repo update



helm install aisix-dp api7/aisix --namespace aisix-dp --version 1.11.0 \

  --set controlPlane.baseURL=https://dp-manager.example.com:7944 \

  --set controlPlane.certificate.existingSecret=aisix-gateway-certificate \

  --set replicaCount=1
```

The gateway appears in the environment's **Data planes** view once its first heartbeat lands. The chart defaults to two replicas, but this initial command starts one because rate-limit counters use per-replica memory until you configure shared Redis. The dashboard Helm snippet omits `replicaCount`, so installing that snippet unchanged starts two replicas. Add `--set replicaCount=1` until Redis is configured, as shown above. [Share Rate-Limit Counters across Replicas](#share-rate-limit-counters-across-replicas) before increasing the replica count or enabling an autoscaler.

Each replica registers as its own instance, and they all share the one certificate.

To see every value the chart accepts:

```
helm show values api7/aisix --version 1.11.0
```

The chart source and package are published in the [`aisix-1.11.0` Helm chart release](https://github.com/api7/api7-helm-chart/releases/tag/aisix-1.11.0).

On OpenShift or OKD, continue at [Run on OpenShift](#run-on-openshift) instead of using the generic exposure options below.

## Expose the Gateway[​](#expose-the-gateway "Direct link to Expose the Gateway")

The chart creates a `ClusterIP` Service for the proxy by default. To publish it through a cloud load balancer:

```
service:

  type: LoadBalancer

  port: 80

  # Preserve the client source IP, which per-model IP allowlists match on.

  externalTrafficPolicy: Local
```

If the load balancer sends a PROXY protocol header instead, put the address the gateway sees as its TCP peer in `config.proxy.real_ip.trusted_proxies`. With the default `externalTrafficPolicy: Cluster`, that peer is a node address. See [Client IP Resolution](https://docs.api7.ai/ai-gateway/deployment/client-ip-resolution.md#behind-a-layer-4-load-balancer).

By default the chart gives the gateway one plain-HTTP proxy listener: it binds `containerPorts.proxy`, port 3000, inside the container, and the Service publishes it as `service.port`. A Service can expose port `80` or `443` without making the process bind a privileged container port.

### Serve HTTPS and Plain HTTP Together[​](#serve-https-and-plain-http-together "Direct link to Serve HTTPS and Plain HTTP Together")

Set `listeners` to serve several proxy ports at once, each with its own TLS:

```
listeners:

  - name: https                 # Port name, shared by the container port and the Service port.

    containerPort: 3443

    servicePort: 443

    # nodePort: 30443           # Optional; only for non-ClusterIP Service types.

    tls:

      secretName: aisix-proxy-tls

  - name: http

    containerPort: 3000

    servicePort: 80
```

A non-empty `listeners` is the complete set of proxy listeners and replaces the single default one. Nothing binds `containerPorts.proxy`, and `service.port` and `service.nodePort` are not read, because each entry carries its own. There is still one proxy Service, and it publishes one port per entry, targeting that entry's container port by name.

Every listener serves the same routes, `/livez` and `/readyz` included, so the startup, readiness, and liveness probes target the first entry — over HTTPS when that entry terminates TLS, and the kubelet does not verify the certificate. The chart writes the set to the gateway's configuration file as `proxy.listeners`. It still writes `proxy.addr`, which the gateway then ignores and logs an informational line about; no action is needed for that line. This needs a gateway image that supports `proxy.listeners`.

For the gateway-side rules behind these values, including why a plaintext listener needs a trusted network interface, see [Serve HTTPS and HTTP at the Same Time](https://docs.api7.ai/ai-gateway/deployment/tls-and-mtls.md#serve-https-and-http-at-the-same-time).

The gateway reads TLS material from files, so each TLS listener needs its own `kubernetes.io/tls` Secret, with the keys `tls.crt` and `tls.key`. The chart mounts it read-only at `/etc/aisix/tls/<name>`. Create it from a certificate and key you already hold:

```
kubectl -n aisix-dp create secret tls aisix-proxy-tls \

  --cert=./tls.crt --key=./tls.key
```

Or have [cert-manager](https://cert-manager.io) issue and renew it into the same Secret:

```
apiVersion: cert-manager.io/v1

kind: Certificate

metadata:

  name: aisix-proxy-tls

  namespace: aisix-dp

spec:

  secretName: aisix-proxy-tls

  dnsNames:

    - gateway.example.com

  issuerRef:

    name: letsencrypt

    kind: ClusterIssuer
```

A rotated certificate reaches the gateway as a changed file in that mount. Roll the pods to pick it up, using the Deployment name from the chart's post-install notes. A release name containing `aisix` is normally used unchanged; name overrides can change the result:

```
kubectl rollout restart deployment/<deployment-name> -n <namespace>
```

### Bind a Privileged Container Port[​](#bind-a-privileged-container-port "Direct link to Bind a Privileged Container Port")

Bind a port below `1024` inside the container only when the gateway must listen on that port directly. The published image runs as non-root UID `10001`, and the gateway binary carries the effective `CAP_NET_BIND_SERVICE` file capability:

```
containerPorts:

  proxy: 80
```

When `listeners` is set, put the privileged port on the entry that should bind it, as its `containerPort`; `containerPorts.proxy` is not read then.

If you customize the rendered Pod to drop all capabilities, add `NET_BIND_SERVICE` back to the AISIX container:

```
spec:

  containers:

    - name: aisix

      securityContext:

        capabilities:

          drop: ["ALL"]

          add: ["NET_BIND_SERVICE"]
```

The Kubernetes Restricted Pod Security Standard allows this capability. Because the binary's file capability has the effective bit set, the container can fail with `exec: Operation not permitted` when the runtime prevents the capability from being granted.

Use `hostNetwork` or `hostPort` only when the gateway must bind directly on a node and the cluster policy allows it. These options introduce node-port conflicts and reduce network isolation; the Baseline and Restricted Pod Security Standards also disallow them.

See [Network and Security](https://docs.api7.ai/ai-gateway/deployment/network-and-security.md) for the full exposure and credential model.

## Run on OpenShift[​](#run-on-openshift "Direct link to Run on OpenShift")

These platform steps apply to a gateway connected to AISIX Enterprise or AISIX Cloud after you have the environment's data-plane manager endpoint and gateway certificate. AISIX Cloud onboarding and connection details are coordinated through API7, while the gateway remains customer-operated.

The chart runs under the default `restricted-v2` Security Context Constraint (SCC) without a custom SCC or service-account change. It leaves `runAsUser`, `runAsGroup`, and `fsGroup` unset so the project assigns them. The container uses a read-only root filesystem, disables privilege escalation, and drops every capability except `NET_BIND_SERVICE`; runtime-writable paths use `emptyDir` volumes.

Do not grant the gateway service account `anyuid`. If a cluster administrator allocates fixed IDs for an organization policy or custom volume, set `podSecurityContext.runAsUser`, `podSecurityContext.runAsGroup`, and `podSecurityContext.fsGroup` to those allocated values. Do not reuse image UID `10001` unless it belongs to the project's allowed range.

Create an edge Route to the default plain-HTTP `proxy` Service port. If the cluster administrator supplied the applications domain, set `ROUTE_DOMAIN` to it and omit the first export below:

```
export ROUTE_DOMAIN="$(oc get ingresses.config.openshift.io cluster \

  -o jsonpath='{.spec.domain}')"

export GATEWAY_ROUTE_HOST="aisix-gateway.$ROUTE_DOMAIN"



oc create route edge aisix-dp \

  --service=aisix-dp \

  --port=proxy \

  --hostname="$GATEWAY_ROUTE_HOST" \

  --namespace aisix-dp
```

The command uses the default release name and `proxy` Service port. If the release uses a name override or custom listeners, run `oc get service -n aisix-dp` and substitute the actual Service name and named port.

The default applications domain normally uses a wildcard certificate signed by the cluster's internal ingress CA. When that CA is not already trusted on the workstation, export it for the verification request:

```
oc get configmap default-ingress-cert -n openshift-config-managed \

  -o jsonpath='{.data.ca-bundle\.crt}' > ingress-ca.crt

export CURL_CA_BUNDLE="$PWD/ingress-ca.crt"
```

If the administrator supplied the CA file, save it as `ingress-ca.crt` and run only the `CURL_CA_BUNDLE` export. Skip this export when the Route or default Ingress Controller uses a certificate that the workstation already trusts.

Wait for the Deployment, then confirm its assigned SCC, UID, readiness, and control-plane heartbeat:

```
oc rollout status deployment/aisix-dp -n aisix-dp --timeout=5m



export GATEWAY_POD="$(oc get pod -n aisix-dp \

  -l 'app.kubernetes.io/instance=aisix-dp,app.kubernetes.io/component=gateway' \

  -o jsonpath='{.items[0].metadata.name}')"



oc get pod -n aisix-dp "$GATEWAY_POD" \

  -o jsonpath='{.metadata.annotations.openshift\.io/scc}{"\n"}'

oc exec -n aisix-dp "$GATEWAY_POD" -- id -u



curl -fsS "https://$GATEWAY_ROUTE_HOST/readyz"
```

The first output line should report `restricted-v2`, the second should show the UID used by the running process, and the readiness request should return `ok`. Confirm that the UID is in the project range and that the managed control plane reports a healthy gateway with a current heartbeat.

## Run on OKD[​](#run-on-okd "Direct link to Run on OKD")

The [OpenShift steps](#run-on-openshift) apply unchanged on OKD. AISIX Cloud customers should still coordinate the hosted control-plane onboarding and connection details with API7.

## Share Rate-Limit Counters across Replicas[​](#share-rate-limit-counters-across-replicas "Direct link to Share Rate-Limit Counters across Replicas")

Rate-limit counters live in each gateway's own memory by default, so *N* replicas enforce *N* times every configured request, token, and concurrency limit. Before running more than one replica — including any replica an autoscaler adds — point every replica at one Redis:

```
rateLimit:

  backend: redis

  redis:

    url: redis://redis.default.svc:6379
```

Use `rateLimit.redis.existingSecret` instead when the connection URL carries a password. To supply the Redis username and password separately from the URL, read them from a Secret through `configSecrets`, as described in [Set Any Other Gateway Configuration](#set-any-other-gateway-configuration). Other settings of the shared Redis connection, such as `mode`, `nodes`, or `timeout_secs`, go under `config.ratelimit.redis`.

After every replica points to the same Redis deployment, increase `replicaCount` or enable one of the autoscaling options below. If the deployment does not use request, token, or concurrency limits, you can deliberately accept the per-replica memory backend instead.

## Scale on CPU or Memory[​](#scale-on-cpu-or-memory "Direct link to Scale on CPU or Memory")

`autoscaling` creates a `HorizontalPodAutoscaler` for the gateway Deployment:

```
autoscaling:

  enabled: true

  minReplicas: 2

  maxReplicas: 20

  targetCPUUtilizationPercentage: 70
```

The targets are percentages of the pod's resource *requests*. The chart sets no default `resources`, so set the matching request yourself:

```
resources:

  requests:

    cpu: "2"

    memory: 1Gi

config:

  proxy:

    workers: 2
```

The values above are an illustration, not a recommendation; size them from your own load. With `autoscaling.enabled: true`, a CPU utilization target without `resources.requests.cpu`, or a memory utilization target without `resources.requests.memory`, fails the Helm render, because the autoscaler could never scale. `targetCPUUtilizationPercentage` defaults to `70`, so enabling autoscaling alone needs a CPU request; set the target to `null` to scale without one. A KEDA `cpu` or `memory` trigger with `metricType: Utilization`, KEDA's default, needs the matching request in the same way. Avoid a CPU limit: throttling adds tail latency to a proxy and suppresses the signal the autoscaler reads. Scaling on CPU requires `metrics-server` in the cluster.

`config.proxy.workers` has no chart default. Unset, the gateway uses the CPU parallelism available to the process. A Kubernetes CPU request does not constrain that value, but a CPU limit does, so without a CPU limit the gateway starts one worker per CPU of the node. Set `config.proxy.workers` to the number of CPU cores you allocate to each replica. The same value sizes the gateway's token-estimate pool, with one thread per worker, and each thread holds its own tokenizer for every encoding it has used: about 17 MiB for cl100k, 27 MiB for o200k, and 39 MiB for o200k\_harmony. Size the memory request for the worker count. See [Thread-per-Core Workers](https://docs.api7.ai/ai-gateway/deployment/thread-per-core-workers.md) for worker configuration and sizing considerations.

When autoscaling is enabled, the Deployment omits `spec.replicas` so that a later `helm upgrade` cannot reset the replica count the autoscaler chose. The `replicaCount` value is ignored from then on.

Pass any `behavior` policy through unchanged, for example to make scale-down gentler than the Kubernetes default:

```
autoscaling:

  behavior:

    scaleDown:

      stabilizationWindowSeconds: 300

      policies:

        - type: Pods

          value: 1

          periodSeconds: 60
```

Use `autoscaling.extraMetrics` for Pods, Object, or External metrics such as a series exposed through a Prometheus adapter.

## Scale on Request Load with KEDA[​](#scale-on-request-load-with-keda "Direct link to Scale on Request Load with KEDA")

CPU is a proxy for load. To scale on the gateway's own traffic instead, use [KEDA](https://keda.sh) and a Prometheus query over the [gateway metrics](https://docs.api7.ai/ai-gateway/observability/metrics-and-usage-events.md).

Before enabling the example, prepare these cluster components:

* Install KEDA, including the `ScaledObject` CRD and controller.
* Provide a Prometheus server that can query the gateway metrics.
* If the chart should create the scrape configuration shown below, install Prometheus Operator or another controller that consumes `ServiceMonitor` objects. Installing only the CRD lets Helm create the object, but nothing turns it into scrape configuration. Set `metrics.serviceMonitor.labels` when the Prometheus instance selects ServiceMonitors by label. If Prometheus discovers the metrics Service another way, leave `metrics.serviceMonitor.enabled` set to `false` and omit that block.

Confirm the CRDs required by the values you enable:

```
kubectl get crd scaledobjects.keda.sh

# Required only when metrics.serviceMonitor.enabled is true.

kubectl get crd servicemonitors.monitoring.coreos.com
```

Configure the chart after those prerequisites are available:

```
metrics:

  serviceMonitor:

    enabled: true



keda:

  enabled: true

  minReplicas: 2

  maxReplicas: 20

  pollingInterval: 15

  cooldownPeriod: 300

  triggers:

    - type: prometheus

      metadata:

        serverAddress: http://prometheus.monitoring.svc:9090

        query: sum(rate(aisix_llm_requests_total[2m]))

        threshold: "100"
```

`aisix_llm_requests_total` counts model-inference requests, such as `/v1/chat/completions`. It does not include MCP or A2A calls. Use [`aisix_proxy_requests_total`](https://docs.api7.ai/ai-gateway/reference/metrics.md#request-metrics) if that is the load you want to scale on.

A streamed request is counted when its stream ends, not when it starts. While a burst of long streams is in progress, a `rate()` over either counter therefore lags behind the incoming load by roughly the length of one stream; steady-state rates are unchanged. Account for that delay when you choose `pollingInterval` and the query window.

`autoscaling` and `keda` are mutually exclusive. Enabling both fails the Helm render rather than letting two controllers write `spec.replicas`.

## What Happens during a Scaling Event[​](#what-happens-during-a-scaling-event "Direct link to What Happens during a Scaling Event")

A replica the autoscaler adds does not receive traffic before it can serve it. A connected gateway first retrieves configuration from its control plane. Until that configuration is usable, the gateway does not bind the proxy listener, so every probe the chart points at that listener is refused rather than answered. The same wait applies to an open-source AISIX gateway configured to load dynamic resources from etcd.

An open-source AISIX gateway that uses a resources file loads and validates the file synchronously during process startup. With a valid file, its configuration is ready before the proxy listener binds. With an invalid file, the process exits with the validation report. Kubernetes restarts the container because the process failed; it does not wait for the startup-probe budget to expire.

The chart's `startupProbe` covers the control-plane or etcd wait. Kubernetes holds the readiness and liveness probes back until a startup probe succeeds, so the pod stays out of Service endpoints while it retrieves and applies its initial configuration. The startup probe's budget is `periodSeconds x failureThreshold`; size it for that configuration-source wait. If the source remains unavailable past the budget, Kubernetes restarts the container. Repeated restarts appear as `CrashLoopBackOff`. See [Startup and the First Configuration](https://docs.api7.ai/ai-gateway/deployment/health-checks.md#startup-and-the-first-configuration) for the readiness contract and how to size the budget.

When a replica scales down, Kubernetes starts removing it from Service endpoints and terminating the pod concurrently. Two chart values protect in-flight requests while that happens.

`preStopSleepSeconds` pauses before the container receives `SIGTERM`, so endpoint removal reaches every node before the gateway begins shutting down. That covers a balancer watching the Kubernetes API; one that polls a health check instead sees a still-ready pod throughout the pause and is covered by the gateway's own drain window, `shutdown.min_drain_secs`.

`terminationGracePeriodSeconds` caps the pause, the drain window, and the in-flight drain that follows. When snapshot persistence is enabled, it also covers up to five more seconds for an outstanding cache write. The gateway drains in-flight requests without a deadline of its own. The Kubernetes default of 30 seconds would cut a streaming response, so the chart ships a longer one.

Both values ship with defaults sized for endpoint withdrawal and long-running requests; `helm show values api7/aisix --version 1.11.0` reports the defaults for this release. Raise `terminationGracePeriodSeconds` for workloads that stream, or keep Realtime WebSocket sessions open, beyond the remaining budget after the pause and drain window. When snapshot persistence is enabled, also leave five seconds for the cache-write drain.

To watch scaling decisions and the metrics behind them:

```
kubectl -n aisix-dp get hpa aisix-dp --watch

kubectl -n aisix-dp describe hpa aisix-dp
```

## Survive Node Disruption[​](#survive-node-disruption "Direct link to Survive Node Disruption")

A `PodDisruptionBudget` limits voluntary evictions, such as node drains, so that the configured number of gateway replicas remains available. The example below prefers spreading replicas across zones:

```
podDisruptionBudget:

  enabled: true

  minAvailable: 50%



topologySpreadConstraints:

  - maxSkew: 1

    topologyKey: topology.kubernetes.io/zone

    whenUnsatisfiable: ScheduleAnyway

    labelSelector:

      matchLabels:

        app.kubernetes.io/name: aisix
```

`ScheduleAnyway` is a placement preference, so replicas can share a zone when capacity is constrained. Use `DoNotSchedule` when the spread constraint must be enforced, and plan enough capacity in eligible zones to avoid Pending pods. Set the selector to the labels used by this gateway release.

The chart uses an `emptyDir` volume for `/var/lib/aisix`. It survives a container restart within the same Pod but is lost when the Pod is replaced. A control-plane-connected replacement reconstructs its identity from the certificate Secret and downloads configuration from the control plane; a replacement open-source AISIX gateway mounts and loads its resources file. Keep multiple replicas across failure domains so an existing replica can continue serving during a replacement.

For a gateway connected to AISIX Enterprise or AISIX Cloud to recover cached configuration after a Pod replacement while the control plane is unavailable, customize the workload in two ways. Give each replica its own persistent state directory, and set `config.managed.snapshot_cache_enabled` to `true`. Persistent storage alone does not enable the cache. See [Restart from Cached Configuration](https://docs.api7.ai/ai-gateway/cloud/offline-resilience.md#restart-from-cached-configuration) for the full recovery and security requirements.

For the wider deployment pattern used by either AISIX Enterprise or AISIX Cloud, see [High Availability](https://docs.api7.ai/ai-gateway/cloud/high-availability.md).

## Set Any Other Gateway Configuration[​](#set-any-other-gateway-configuration "Direct link to Set Any Other Gateway Configuration")

The chart owns the pod and its startup configuration in both gateway modes. The control plane owns a connected gateway's dynamic resources, while the resources file owns an open-source AISIX gateway's resources. The gateway reads its [startup configuration](https://docs.api7.ai/ai-gateway/deployment/startup-configuration.md) from a file that the chart renders into a ConfigMap and mounts read-only. The `config` value mirrors that file key for key, with the same section and key names as the [Startup Configuration Reference](https://docs.api7.ai/ai-gateway/reference/configuration-files.md), and lists every setting with the gateway's default. Set only the keys you need to change:

```
config:

  observability:

    log_level: debug

  upstream:

    pool_max_idle_per_host: 32

  proxy:

    real_ip:

      # Proxies trusted to set X-Forwarded-For or send a PROXY protocol header.

      trusted_proxies: ["10.0.0.0/8"]

      recursive: true
```

A key set to `null` is left out of the file, so the gateway uses its own default. A change to `config` rolls the pods on `helm upgrade`. Run `helm show values api7/aisix --version 1.11.0` to see every key.

The chart sets some keys from its other values and refuses them under `config`. The render fails with a message naming the value to use instead:

| Configuration key                                                  | Chart value                                                                                                                                                                                    |
| ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `proxy.addr`, `observability.metrics.prometheus.addr`              | `containerPorts`                                                                                                                                                                               |
| `proxy.listeners`, `proxy.tls`                                     | `listeners`                                                                                                                                                                                    |
| `ratelimit.backend`, `ratelimit.redis.url`                         | `rateLimit`                                                                                                                                                                                    |
| `managed.enabled` and the control-plane connection under `managed` | `controlPlane`                                                                                                                                                                                 |
| `etcd.endpoints`, `etcd.prefix`                                    | Set from the control-plane connection.                                                                                                                                                         |
| `etcd.env_id`, `etcd.user`, `etcd.password_env`, `etcd.tls`        | Not configurable through this chart.                                                                                                                                                           |
| `resources_file`                                                   | `standalone`                                                                                                                                                                                   |
| `admin`                                                            | `admin` and `containerPorts.admin`, in standalone mode only. See [Enable the Admin API](https://docs.api7.ai/ai-gateway/deployment/open-source-gateway-on-kubernetes.md#enable-the-admin-api). |

Settings that hold a credential never enter the ConfigMap. Store the value in a Secret and reference it under `configSecrets`, keyed by the configuration path. The chart hands it to the gateway as an environment variable, which overrides the configuration file:

```
config:

  cache:

    backend: redis

    redis:

      mode: single

configSecrets:

  cache.redis.url:

    secretName: aisix-cache-redis

    key: url

  cache.redis.password:

    secretName: aisix-cache-redis

    key: password
```

`configSecrets` accepts `cache.redis.url`, `cache.redis.username`, `cache.redis.password`, `ratelimit.redis.username`, and `ratelimit.redis.password`. The chart also refuses these keys under `config`. The rate-limit Redis URL comes from `rateLimit.redis`.

Use `extraEnvVars` only for system-level environment variables, such as `TZ`, and for variables that a standalone resources file references. An `AISIX_*` variable set there still overrides the configuration file. See [Environment Variables](https://docs.api7.ai/ai-gateway/reference/environment-variables.md) for the naming rules.

An `extraEnvVars` override still wins, but it is only a compatibility path for existing deployments. While an override carried forward from chart 1.5.0 remains, the chart can render the old entry ahead of it, so the container lists the name twice and Helm 4 server-side apply rejects the manifest. The target chart may move that setting into the configuration file or may still render one environment entry after the override is removed; only the second case needs the two-pass cleanup. New installations use the chart value, `config`, or Secret-backed setting directly. See [Prepare Application Settings](https://docs.api7.ai/ai-gateway/deployment/upgrade-gateway-on-kubernetes.md#prepare-application-settings) before upgrading an existing release.

## Next Steps[​](#next-steps "Direct link to Next Steps")

Use [Prepare for Production](https://docs.api7.ai/ai-gateway/deployment/production.md) to review replica count, capacity, observability, and failure-domain planning. For gateway upgrades, follow [Upgrade a Gateway on Kubernetes](https://docs.api7.ai/ai-gateway/deployment/upgrade-gateway-on-kubernetes.md) for values and image checks, rollout verification, and rollback.
