Configure GatewayAPI Gateway
TOC
OverviewPrerequisitesGateway BasicsWhat is a GatewayGateway Exposure (Service Type)LoadBalancer (Recommended)NodePortClusterIPListener ConfigurationPort and ProtocolAllowRouteNSTLS ConfigurationEnvoyProxy (Deployment Configuration)Image RepositoryCreate GatewayVia Web ConsoleListener ConfigurationVia YAMLComplete Example with Multiple Listener TypesView Gateway DetailsListener and Route ReferenceHostnameHostname Intersection RuleSupported Route KindsNext StepOverview
This document explains how to configure a Gateway after the Envoy Gateway operator and EnvoyGatewayCtl are ready.
A Gateway defines how traffic enters the gateway, while the companion EnvoyProxy controls how the underlying Envoy
data plane is deployed.
In the recommended workflow, this document comes after Envoy Gateway Operator and before Configure GatewayAPI Route.
Prerequisites
Please ensure that you have completed the following before proceeding:
- Read Envoy Gateway Operator to understand the basic concepts and resource relationships
- Install the Envoy Gateway operator and create an
EnvoyGatewayCtl
This document first explains the main Gateway concepts and then shows how to create a Gateway. If you are already
familiar with these concepts, you can skip to the Create Gateway section.
Gateway Basics
What is a Gateway
A Gateway is the entry point for traffic entering your cluster. It defines how external requests are received and
routed to your backend services. A Gateway mainly defines:
- Listeners: Define the ports, protocols, and hostnames the gateway listens on
- GatewayClass: Selects which gateway controller manages this
Gateway - Infrastructure reference: References an
EnvoyProxythat controls how the underlying Envoy data plane is deployed
Gateway Exposure (Service Type)
Service Type configures how the gateway is exposed through the underlying Envoy Service. There are three modes: LoadBalancer, NodePort, and ClusterIP.
In YAML, this setting is configured in the companion EnvoyProxy resource at
.spec.provider.kubernetes.envoyService.type.
LoadBalancer (Recommended)
The advantage is ease of use and high-availability load balancing capabilities. To use LoadBalancer, the cluster must have LoadBalancer support, which can be enabled via MetalLB.
NodePort
The advantage is that it doesn't require any external dependencies.
However, using NodePort has these disadvantages:
- When using NodePort, Kubernetes assigns NodePort port numbers that differ from the service's own ports. You must use the NodePort port number for access, not the service port.
- The service can be accessed via any node IP address in the cluster, which may pose potential security risks.
How to Get the Correct Port When Using NodePort
In the Gateway details page, when Service Type is NodePort, the listener list displays the NodePort column showing the assigned port numbers. You can also use the following command:
The output is the NodePort.
ClusterIP
Very convenient if you don't need external exposure.
Listener Configuration
A Listener defines the port and protocol for the gateway to listen on. In HTTP or HTTPS protocols, different hostnames can be treated as different listeners.
You cannot create a listener with a conflicting port, protocol, or hostname.
You must create at least one listener in the Gateway.
Port and Protocol
Each listener is configured with a port number and a protocol. Supported protocols are: HTTP, HTTPS, TCP, UDP, TLS.
AllowRouteNS
By default, Routes can only attach to a Gateway in the Same namespace. To allow cross-namespace routing, use the Allowed Routes Namespace field:
Same: Allow Routes in the same namespace to attach to this listener.All: Allow Routes in any namespace to attach to this listener.Selector: Allow Routes in namespaces matched by the selector to attach to this listener.
In ACP, a project is identified by labels on namespaces, for example cpaas.io/project: <project-name>. If you want a listener to
be used only by Routes from a specific project, use Selector and match the project label on the target namespaces.
The listener's Allowed Routes Namespace setting and its protocol together determine which listeners are available in
the Route Web Console when you publish a route to a listener.
For more information, see attach to gateway created in other ns.
TLS Configuration
For HTTPS and TLS protocols, you need to configure TLS settings.
TLS Modes:
- HTTPS protocol only supports Terminate mode
- TLS protocol supports both Terminate and Passthrough modes
- TLS listeners with Passthrough mode support TLSRoute
- TLS listeners with Terminate mode support TCPRoute
Certificate Requirements:
- By default, you can only use secrets created in the same namespace
- The secret must be of type
kubernetes.io/tlsand containtls.crtandtls.keykeys - For cross-namespace secrets, see use secret created in other ns
EnvoyProxy (Deployment Configuration)
Envoy Gateway uses the EnvoyProxy resource to control gateway deployment configurations. We recommend creating a dedicated EnvoyProxy resource for each Gateway and referencing it through the Gateway's .spec.infrastructure.parametersRef field.
When you create a Gateway from the Web Console by using a GatewayClass created by EnvoyGatewayCtl, the console
automatically creates a companion EnvoyProxy resource with the same name and namespace.
When you create a Gateway by applying YAML, you are responsible for keeping the Gateway
.spec.infrastructure.parametersRef and the referenced EnvoyProxy resource consistent.
This one-to-one mapping approach provides better isolation and more granular control over deployment configurations such as:
- Replicas
- Resource limits and requests
- Node selectors
- Service type and annotations
- Image repository
Image Repository
The image repository is pre-configured with the default value for your cluster. Do not modify it unless necessary.
For other deployment configuration methods, see deployment-mode.
Create Gateway
Via Web Console
- Navigate to
Alauda Container Platform -> Networking -> Gateway -> Gateways - Click the
Create Gatewaybutton - On the
Create Gatewaypage, select theGatewayClasscreated by yourEnvoyGatewayCtl. In the recommended default example from Envoy Gateway Operator, this isenvoy-gateway-operator-cpaas-default.
The page displays the following configuration options:
The Web Console form only supports GatewayClasses created by EnvoyGatewayCtl. For other GatewayClasses, use the YAML editor.
When using an EnvoyGatewayCtl-created GatewayClass, the Web Console automatically creates a companion EnvoyProxy resource matching the Gateway's name and namespace.
Listener Configuration
When creating or editing a listener, you can configure the following:
HTTPS Protocol Configuration
When selecting HTTPS as the protocol:
- HTTPS protocol only supports Terminate mode
- Certificate selection is mandatory for HTTPS listeners
- You can only use secrets created in the same namespace by default
TLS Protocol Configuration
When selecting TLS as the protocol:
Configuration Fields
For TLS mode details, see TLS Configuration.
Via YAML
Replace envoy-gateway-operator-cpaas-default with the GatewayClass created by your own EnvoyGatewayCtl if you are
not using the recommended default example.
The following minimal example creates an HTTP Gateway and a dedicated EnvoyProxy.
Complete Example with Multiple Listener Types
If you need more listener types, use the following complete example:
- Reference to EnvoyProxy resource for deployment configuration
- Replace
envoy-gateway-operator-cpaas-defaultwith your ownGatewayClassif needed listenersdefines how traffic enters the gatewayhostnameaffects how host-based routing matches the listenerprotocoldetermines which route kinds can attach to the listenerallowedRoutescontrols which namespaces can attach routestlsconfigures TLS termination or passthrough for HTTPS and TLS listeners- The
EnvoyProxyname must match.spec.infrastructure.parametersRef.name envoyService.typecontrols gateway exposure- Keep
imageRepositoryunchanged unless necessary for your environment resourcesconfigures the Envoy data plane resource limits and requests- Keep
provider.typeasKubernetes
View Gateway Details
In the Gateway details page, the listener list shows the following information:
When the Gateway Service Type is NodePort, the listener list displays an additional NodePort column. Use the NodePort value, not the service port, to access the gateway. For more details, see How to Get the Correct Port When Using NodePort.
Listener and Route Reference
Use the following rules when attaching Route resources to a Gateway.
Hostname
The hostname in a listener is a unique identifier for listeners that have the same protocol. You cannot add or update a conflicting listener in a gateway.
Hostname Intersection Rule
When a request arrives, it is matched against the intersection of the Listener's hostname and the Route's hostnames. Only hostnames in the intersection are used for routing traffic.
Wildcards (*) perform suffix matching. For example, *.example.com matches foo.example.com and bar.example.com,
but not example.com.
No intersection means the Route status becomes abnormal and traffic cannot be processed.
Supported Route Kinds
Each listener supports different route kinds based on its protocol:
When configuring routes, ensure they match the protocol of the listener they attach to. For example, you cannot attach
an HTTPRoute to a TCP listener.
Next Step
After the Gateway is ready, continue with Configure GatewayAPI Route. If you need
advanced traffic control after routes are attached, continue with Configure GatewayAPI Policy.