For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Advanced settings
Install agentgateway and related components.
You can update several installation settings in your Helm values file. For example, you can update the namespace, set resource limits and requests, or enable extensions such as for AI.
Show all values:
helm show values oci://cr.agentgateway.dev/charts/agentgateway --version $NEW_VERSIONGet a file with all values: You can get a
agentgateway/values.yamlfile for the upgrade version by pulling and inspecting the Helm chart locally.helm pull oci://cr.agentgateway.dev/charts/agentgateway --version $NEW_VERSION tar -xvf agentgateway-$NEW_VERSION.tgz open agentgateway/values.yaml
For more information, see the Helm reference docs.
Development builds
When using the development build 0.0.0-latest-dev, add --set controller.image.pullPolicy=Always to ensure you get the latest image. For production environments, this setting is not recommended as it might impact performance.
Experimental Gateway API features
Experimental Gateway API features follow the channel of the Gateway API CRDs that you install. To use a feature that is experimental in your Gateway API version, install the experimental channel of the Gateway API CRDs.
For the list of experimental features and the install command, see Experimental features in Gateway API.
Leader election
Leader election is enabled by default to ensure that you can run agentgateway in a multi-control plane replica setup for high availability.
You can disable leader election by setting the controller.disableLeaderElection to true in your Helm chart.
controller:
disableLeaderElection: trueAutoscaling
You can configure Horizontal Pod Autoscaler or Vertical Pod Autoscaler policies for the agentgateway control plane. To set up these policies, you use the horizontalPodAutoscaler or verticalPodAutoscaler fields in the Helm chart.
Note
Note that agentgateway uses leader election if multiple replicas are present. The elected leader’s workload is typically larger than the workload of non-leader replicas and therefore drives the overall infrastructure cost. Because of that, Vertical Pod Autoscaling can be a reasonable solution to ensure that the elected leader has the resources it needs to perform its work successfully. In cases where the leader has a large workload, Horizontal Pod Autoscaling might not be as effective as it adds more replicas that do not reduce the workload of the elected leader.
Warning
If you plan to set up both VPA and HPA policies, make sure to closely monitor performance and cost during scale up events. Using both policies can lead to conflict or even destructive loops that impact the performance of your control plane.
Vertical Pod Autoscaler (VPA)
Vertical Pod Autoscaler (VPA) is a Kubernetes component that automatically adjusts the CPU and memory reservations of your pods to match their actual usage.
The following Helm configuration ensures that the control plane pod is always assigned a minimum of 0.1 CPU cores (100millicores) and 128Mi of memory.
verticalPodAutoscaler:
updatePolicy:
updateMode: Auto
resourcePolicy:
containerPolicies:
- containerName: "*"
minAllowed:
cpu: 100m
memory: 128MiHorizontal Pod Autoscaler (HPA)
Horizontal Pod Autoscaler (HPA) adds more instances of the pod to your environment when certain memory or CPU thresholds are reached.
In the following example, you want to have 1 control plane replica running at any given time. If the CPU utilization averages 80%, you want to gradually scale up your replicas. You can have a maximum of 5 replicas at any given time.
horizontalPodAutoscaler:
minReplicas: 1
maxReplicas: 5
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80Note: To monitor the memory and CPU threshold, you need to deploy the Kubernetes metrics-server in your cluster. The metrics-server retrieves metrics, such as CPU and memory consumption for your workloads.
You can install the server with the following command:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
kubectl -n kube-system patch deployment metrics-server \
--type=json \
-p='[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]'Then, start monitoring CPU and memory consumption with the kubectl top pod command.
PriorityClass
You can assign a PriorityClassName to the control plane pods by using the Helm chart. Priority indicates the importance of a pod relative to other pods. If a pod cannot be scheduled, the scheduler tries to preempt (evict) lower priority pods to make scheduling of the pending pod possible.
To assign a PriorityClassName to the control plane, you must first create a PriorityClass resource. The following example creates a PriorityClass with the name system-cluster-critical that assigns a priority of 1 Million.
kubectl apply -f- <<EOF
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: system-cluster-critical
value: 1000000
globalDefault: false
description: "Use this priority class on system-critical pods only."
EOFIn your Helm values file, add the name of the PriorityClass in the controller.priorityClassName field.
controller:
priorityClassName: Common labels
Add custom labels to all resources that are created by the agentgateway Helm charts, including the Deployment, Service, ServiceAccount, and ClusterRoles. This allows you to better organize your resources or integrate with external tooling.
The following snippet adds the label-key and agw-managed labels to all resources.
commonLabels:
label-key: label-value
agw-managed: "true"PodDisruptionBudget
Configure a Pod Disruption Budget to ensure that a minimum number of control plane instances are up and running at any given time during voluntary disruptions, such as upgrades. In this example, 50% of your control plane instances must be running.
controller:
podDisruptionBudget:
minAvailable: 50%Init containers
Use controller.extraInitContainers to run containers before the controller starts. This setting affects only the control plane pod.
Set restartPolicy: Always for a native sidecar container. It starts before the controller and runs for the life of the pod. Native sidecars require Kubernetes 1.29 or later.
The controller image has no shell, so you cannot run commands in the controller container with kubectl exec. The following example adds a shell through a native sidecar. Containers in a pod share a network namespace, so the shell can inspect the controller’s network from inside the pod, such as the ports that the controller listens on or how the pod resolves DNS names.
Create a Helm values file that adds the sidecar.
cat > init-values.yaml <<'EOF' controller: extraInitContainers: - name: debug-shell image: busybox:1.38.0 restartPolicy: Always command: ["sh", "-c", "sleep infinity"] EOFOptional: Render the controller Deployment to check the init container.
helm template agentgateway oci://cr.agentgateway.dev/charts/agentgateway \ --version \ --namespace agentgateway-system \ -f init-values.yaml \ --show-only templates/deployment.yaml | sed -n '/initContainers:/,/containers:/p'Example output:
initContainers: - command: - sh - -c - sleep infinity image: busybox:1.38.0 name: debug-shell restartPolicy: Always containers:Upgrade the controller Helm release with the values file. The controller pod restarts. For more information about upgrades, see Upgrade.
helm upgrade -i agentgateway oci://cr.agentgateway.dev/charts/agentgateway \ --version \ --namespace agentgateway-system \ --reuse-values \ -f init-values.yamlCheck that the controller pod runs both containers.
kubectl get pods -n agentgateway-system -l app.kubernetes.io/name=agentgatewayExample output:
NAME READY STATUS RESTARTS AGE agentgateway-86bd4c7557-8nctr 2/2 Running 0 39sRun a command in the sidecar. For example, list the ports that the controller listens on. The output shows that the controller admin server on port
9095accepts connections only from inside the pod.kubectl exec -n agentgateway-system deploy/agentgateway -c debug-shell -- netstat -tlnExample output:
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:9095 0.0.0.0:* LISTEN tcp 0 0 :::9978 :::* LISTEN tcp 0 0 :::9093 :::* LISTEN tcp 0 0 :::9092 :::* LISTEN
To remove the sidecar, upgrade the release again with --reuse-values --set controller.extraInitContainers=null.
Namespace-scoped write permissions
By default, the controller holds cluster-wide write permissions for the objects that it provisions for a Gateway. To restrict those writes to the namespaces that hold your Gateways, set rbac.gatewayNamespaces in the controller Helm chart.
rbac:
gatewayNamespaces:
- gateway-system
- team-aThe chart then creates a RoleBinding in each listed namespace, instead of the single ClusterRoleBinding that it creates otherwise. Each RoleBinding grants the controller’s service account the agentgateway-<controller-namespace>-deployer ClusterRole, where <controller-namespace> is the namespace that you install the controller in. The chart creates no Role, so audit the ClusterRole to see the permissions and the RoleBindings to see where they apply.
That ClusterRole grants create, delete, patch, and update on the objects that the controller provisions for a Gateway, which are ConfigMaps, Secrets, Services, ServiceAccounts, Deployments, DaemonSets, HorizontalPodAutoscalers, and PodDisruptionBudgets. It also grants create and patch on Events. The cluster-wide role keeps read access to those objects.
Review the following constraints before you set the field.
| Constraint | Detail |
|---|---|
| Only listed namespaces can hold a Gateway | The controller cannot provision a Gateway in a namespace that the list omits. |
| The namespaces must already exist | The chart does not create them. |
The default is an empty rbac.gatewayNamespaces list | An empty list keeps the cluster-wide write access, so an upgrade does not change permissions on its own. |
| Events are scoped too | The controller publishes a warning Event on a Gateway when a proxy rejects its xDS configuration. After you set the field, the controller can create those Events in the listed namespaces only. |
| Cluster-scoped access is unaffected | Cluster-wide read permissions, and writes to cluster-scoped resources such as GatewayClass and status subresources, do not change. |
Chart-created RBAC resources
By default, the controller Helm chart creates the ClusterRoles, Role, ClusterRoleBindings, and RoleBindings that the controller needs. If your cluster manages role-based access control (RBAC) resources outside of Helm, set rbac.create to false. The chart then creates none of these resources.
rbac:
create: falseBefore you install with this setting, create the roles and bindings yourself. To get the rules that the chart would create, render its RBAC templates with rbac.create left at its default value.
helm template agentgateway oci://cr.agentgateway.dev/charts/agentgateway \
--version \
--namespace agentgateway-system \
--show-only templates/role.yaml \
--show-only templates/serviceaccount.yamlThe output has the agentgateway-<controller-namespace> and agentgateway-<controller-namespace>-deployer ClusterRoles, the agentgateway-<controller-namespace>-local Role, and a binding for each to the controller’s service account.
Review the following constraints before you set the field.
| Constraint | Detail |
|---|---|
| The service account is separate | serviceAccount.create still controls whether the chart creates the controller’s ServiceAccount. |
Bindings also need serviceAccount.create | The chart creates the ClusterRoleBindings and RoleBindings only when both rbac.create and serviceAccount.create are true. If you set serviceAccount.create to false to use an existing service account, the chart still creates the roles but no bindings, so bind the roles to that account yourself. |
rbac.gatewayNamespaces has no effect | With rbac.create set to false, the chart creates no RoleBindings in the namespaces that rbac.gatewayNamespaces lists. |
| ClusterTrustBundle read access | If the cluster serves the ClusterTrustBundle API, the controller needs get, list, and watch on clustertrustbundles in the certificates.k8s.io API group. The rendered ClusterRole already includes this rule, and Kubernetes also grants it to all service accounts through the default system:cluster-trust-bundle-discovery ClusterRoleBinding. If you write your own roles and your cluster removes that default binding, add the rule to the controller’s ClusterRole, or the controller does not become ready. |
For the full list of chart values, see the Helm reference.