L4Route¶
Overview¶
This CR defines how the Layer4 routing should be managed within the Kubernetes cluster, allowing requests to be routed at the transport layer (TCP/UDP). L4Route is created based on the experimental TCPRoute/UDPRoute defined by the Gateway API community.
Update service¶
When a backend service is edited, the configuration of the dataplane does not get automatically updated. You must perform these steps in sequence.
Delete the service.
Modify the yaml file of the service.
Reapply the service.
Note
Perform Custom Resource (CR) operations only when the controller is in a running state.
CR Parameters¶
The table below provides the description and implementation details of the supported L4Route spec parameters:
Parameter |
Description |
Default |
|---|---|---|
|
Specifies the application protocol accepted by the listener. Valid values are TCP or UDP. |
|
|
Specifies the name of the referent for the Gateway parent references. |
|
|
Specifies the name of a section within the target resource. |
|
|
Specifies the name to which the route should forward the a request to a Kubernetes resource (backend service) |
|
|
Specifies the port to which the route should forward the a request to a Kubernetes resource (backend service) |
|
|
Enables the preferred acceleration mode for the Packet Velocity ASIC (PVA). The available values are: |
full/assisted |
|
Specifies the number of client packets before dynamic re-offloading occurs. |
1 |
|
Specifies the number of server packets before dynamic re-offloading occurs. |
0 |
Note
Each gateway listener can support only one L4 route. Additionally, if an L4 route includes multiple backend references, all the associated services must share the same IP family. This means that all services must be either dual stack, IPv4, or IPv6. If the IP families differ, some backend references may not receive traffic properly.
L4Route CR Status¶
L4Route condition - Accepted
conditions.status |
conditions.reason |
description |
|---|---|---|
Unknown |
Pending |
Initial state. Waiting for controller |
True |
Accepted |
Accepted |
False |
- NoMatchingParent |
- No Matching Parents by either Name, Port, or SectionName |
L4Route condition - ResolvedRef
conditions.status |
conditions.reason |
description |
|---|---|---|
True |
ResolvedRefs |
References Resolved |
False |
- InvalidKind |
- BackendRef has invalid kind |
L4Route condition - PartiallyInvalid
conditions.status |
conditions.reason |
description |
|---|---|---|
True |
UnsupportedValue |
Found both valid and invalid rules |
Note: Descriptions from the above tables may not exactly match those under the status section of the CR.
Sample CRs¶
Basic L4Route and Gateway API CRs¶
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: f5-gateway-class
spec:
controllerName: f5.com/f5-bnk-instance-f5-cne-controller
description: F5 BIG-IP Kubernetes Gateway
---
apiVersion: gateway.k8s.f5.com/v1alpha1
kind: GatewaySettings
metadata:
name: gw-settings-app-1
namespace: gateway-infra
spec:
ingressConfig:
defaultListenerNetwork:
ipamRefs:
- name: vip-listener-ipam
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: f5-l4-gateway
namespace: gateway-infra
spec:
infrastructure:
parametersRef:
group: gateway.k8s.f5.com
kind: GatewaySettings
name: gw-settings-app-1
gatewayClassName: f5-gateway-class
listeners:
- name: tcp
protocol: TCP
port: 8000
allowedRoutes:
kinds:
- kind: L4Route
group: gateway.k8s.f5.com
---
apiVersion: gateway.k8s.f5.com/v1
kind: L4Route
metadata:
name: my-l4route
namespace: app-ns
spec:
parentRefs:
- name: f5-l4-gateway
sectionName: tcp
namespace: gateway-infra
rules:
- backendRefs:
- name: l4-greeter-server
port: 80
namespace: app-ns
L4Routes traffic weight distribution CR¶
apiVersion: gateway.k8s.f5.com/v1
kind: L4Route
metadata:
name: l4-app-1
spec:
protocol: TCP
parentRefs:
- name: my-l4-gateway
sectionName: tcp
rules:
- backendRefs:
- name: tcp-testapp-rg-0-f5ing-testapp
port: 8050
weight: 70
- name: tcp-testapp-rg-1-f5ing-testapp
port: 8050
weight: 30