Skip to content
Install the CLI

How-to guide Package task guides

Install Envoy Gateway

These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.

Install Envoy Gateway with three experimental Kix packages:

  • gateway-api installs the Kubernetes Gateway API CRDs.
  • envoy-gateway-controller installs the Envoy Gateway controller, its CRDs, and a GatewayClass.
  • envoy-gateway creates a Gateway for application routes. Once running, the controller deploys Envoy proxy pods for each Gateway.

Check the Envoy Gateway compatibility matrix to confirm your cluster’s Kubernetes version is supported by the Envoy Gateway release in envoy-gateway-controller.

Add a gateway-api instance to your cluster definition:

how-to/platform/gateway-cluster.nix
instances.gateway-system.gateway-api.package = packages.experimental.gateway-api;

View source on GitHub ↗

This instance claims the gatewayApi role so the cluster installs only one set of Gateway API CRDs. Every Gateway API controller in the cluster, such as envoy-gateway-controller or traefik, shares them.

If your Kubernetes provider already installs compatible Gateway API CRDs, do not add gateway-api. Instead, set cluster.roles.gatewayApi.binding = "exclusive" and declare the CRDs with kix.mkImport. In the import, set roles = [ "gatewayApi" ], set out.version to the installed Gateway API version, and add a crds entry for each kind your controller uses:

  • envoy-gateway-controller requires Gateway API 1.6 or later and the GatewayClass, Gateway, HTTPRoute, and ReferenceGrant CRDs.
  • traefik requires Gateway API 1.6.1 or later and those four CRDs, plus GRPCRoute, TLSRoute, and BackendTLSPolicy.

Include readiness.condition on GatewayClass (type = "Accepted") and Gateway (type = "Programmed"), both with status = "True", so kix deploy waits until the controller accepts the class and programs the Gateway:

cluster.roles.gatewayApi.binding = "exclusive";
instances.gateway-system.platform-gateway-api.package = kix.mkImport {
roles = [ "gatewayApi" ];
out.version = "1.6.1";
crds = [
{
group = "gateway.networking.k8s.io";
kind = "GatewayClass";
plural = "gatewayclasses";
version = "v1";
crdScope = "Cluster";
readiness.condition = { type = "Accepted"; status = "True"; };
}
{
group = "gateway.networking.k8s.io";
kind = "Gateway";
plural = "gateways";
version = "v1";
readiness.condition = { type = "Programmed"; status = "True"; };
}
{ group = "gateway.networking.k8s.io"; kind = "HTTPRoute"; plural = "httproutes"; version = "v1"; }
{ group = "gateway.networking.k8s.io"; kind = "ReferenceGrant"; plural = "referencegrants"; version = "v1"; }
];
};

If the import is missing a required CRD, a readiness condition, or a supported out.version, evaluation fails and names what to fix.

Add an envoy-gateway-controller instance:

how-to/platform/gateway-cluster.nix
instances.gateway-system.envoy-gateway-controller.package =
packages.experimental.envoy-gateway-controller;

View source on GitHub ↗

Kix allows one envoy-gateway-controller instance per cluster. It reconciles Gateway resources across all namespaces.

Add an envoy-gateway instance with the listeners your applications need. It can share the controller’s namespace or use its own:

how-to/platform/gateway-cluster.nix
instances.gateway-system.gateway = {
package = packages.experimental.envoy-gateway;
config.listeners = [
{
name = "http";
port = 80;
protocol = "HTTP";
allowedRoutes.namespaces.from = "All";
}
];
};

View source on GitHub ↗

Each envoy-gateway instance creates one Gateway and grants the controller permission to deploy Envoy proxy pods and a Service in that namespace. A cluster can run multiple Gateways (such as a public Gateway and a private one), each in its own namespace. By default, envoy-gateway claims the gateway alias that kix.expose routes applications through. To add more envoy-gateway instances, set aliases = [ ]; on the extra instances so only one keeps the default gateway alias, then set deps.gateway = ref.<namespace>.<instance>; on each application that should use another Gateway.

listeners takes Gateway API Listener fields with their upstream names (name, port, protocol, hostname, tls, allowedRoutes); a misspelt field fails evaluation. The example permits routes from every namespace. Restrict allowedRoutes.namespaces if only selected namespaces should attach routes. kix.expose reads these listeners to pick each application’s URL scheme and port, and fails when no listener accepts an application’s host and namespace. An HTTPS listener without tls.certificateRefs is not rendered.

By default, the Envoy proxies get a LoadBalancer Service. On clusters without a load balancer (cluster.roles.loadBalancer.binding = "absent", which kix.flavors.kind sets), the package switches to a NodePort Service so the Gateway can still become ready. Use config.proxySpec (an Envoy Gateway EnvoyProxy spec) to customize this Gateway’s proxy Service, replica count, or pod settings.

When networkPolicy.enable = true, the package allows incoming traffic to the proxy pods on the listener ports, and kix.expose allows the proxy pods to reach each backend Service they route to.

Deploy the Kix cluster:

kix-examples/
❱ kix deploy how-to-platform-gateway

During deploy, Kix installs the CRDs, runs a Job to generate TLS certificates for control-plane traffic between the controller and proxies, and starts the controller. kix deploy waits until the GatewayClass is Accepted and the Gateway is Programmed.

Check the GatewayClass and Gateway:

kix-examples/
❱ kubectl get gatewayclass,gateway --all-namespaces
NAME                                                              CONTROLLER                                      ACCEPTED   AGE
gatewayclass.gateway.networking.k8s.io/envoy-gateway-controller   gateway.envoyproxy.io/gatewayclass-controller   True       24s

NAMESPACE        NAME                                        CLASS                      ADDRESS      PROGRAMMED   AGE
gateway-system   gateway.gateway.networking.k8s.io/gateway   envoy-gateway-controller   172.18.0.5   True         22s

The GatewayClass should report Accepted, and the Gateway should report Programmed. On kind, Envoy Gateway sets the Gateway’s address to a kind node IP.

If either resource stays unready, inspect its conditions and the controller logs:

❱ kubectl describe gatewayclass envoy-gateway-controller
❱ kubectl describe gateway gateway -n gateway-system
❱ kubectl logs -n gateway-system deployment/envoy-gateway --since=10m

Earlier versions of envoy-gateway created the GatewayClass and Gateway and expected you to install the controller with Envoy Gateway’s Helm chart. Because two controllers must not reconcile the same GatewayClass, uninstall the Helm release before deploying the upgraded package. The commands below assume the Helm release is named eg in the envoy-gateway-system namespace, matching Envoy Gateway’s install guide.

Envoy Gateway’s Helm chart installs the experimental Gateway API CRDs, while gateway-api installs the standard channel. Check your routes and Gateways before upgrading:

  • Applying the standard CRDs drops experimental-only fields from existing routes and Gateways. Remove any experimental fields before you deploy gateway-api.
  • The experimental-only CRDs (xbackends, xbackendtrafficpolicies, and xmeshes in gateway.networking.x-k8s.io) remain in the cluster. Delete them once nothing uses them.

Uninstall the Helm release:

❱ helm uninstall eg --namespace envoy-gateway-system

Uninstalling the Helm release leaves the CRDs in place, and the existing Envoy proxy pods continue serving traffic with their last configuration. Helm does not delete hook resources on uninstall, so it also leaves behind the eg-gateway-helm-certgen ServiceAccount, Role (which still grants write access to Secrets), RoleBinding, ClusterRole, ClusterRoleBinding, and Job, along with the topology injector webhook. Delete them:

❱ kubectl delete serviceaccount,role,rolebinding,job --namespace envoy-gateway-system --selector app.kubernetes.io/instance=eg
❱ kubectl delete clusterrole,clusterrolebinding,mutatingwebhookconfiguration --selector app.kubernetes.io/instance=eg

Next, update your cluster definition:

  • Add the gateway-api instance shown in Add the Gateway API CRDs.
  • Add the envoy-gateway-controller instance shown in Add the controller.
  • Remove controllerName, proxyNamespace, gatewayClassName, and gatewayName from the envoy-gateway instance. Setting any of them now fails evaluation.
  • If config.proxySpec only sets envoyService.type = "NodePort" for kind, remove it. The package now sets NodePort automatically when the cluster has no load balancer.

Because Helm still owns fields on the existing CRDs, the first deploy stops with a server-side apply conflict. Run kix deploy once with --force-conflicts to transfer field ownership to Kix:

❱ kix deploy <cluster> --force-conflicts

Subsequent deploys do not need --force-conflicts.

Envoy Gateway now deploys each Gateway’s proxy pods in the envoy-gateway instance’s namespace, using a Deployment and Service named after the Gateway. Because the Helm-installed controller created them under generated names in Helm’s namespace (such as envoy-gateway-system), the new controller creates a new proxy Deployment and Service while the old ones keep running.

On a cloud load balancer, the new Service receives a new IP address:

  • Use the new IP address: Point DNS at the new address, then delete the old proxy resources with the command below.
  • Keep the old IP address with config.addresses: Delete the old proxy resources before running kix deploy so kix deploy can wait for the Gateway to become Programmed on that IP. Because the old Service holds the IP until you delete it, the Gateway serves no traffic between the deletion and the new Service claiming the address.

Delete the old proxy resources from Helm’s namespace:

❱ kubectl delete deployment,service,serviceaccount,configmap,hpa,pdb --namespace envoy-gateway-system --selector app.kubernetes.io/managed-by=envoy-gateway