skip to content
Alvin Lucillo

Splitting traffic with httproute

/ 1 min read

An example of traffic splitting with a gateway is this:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: web-route
  namespace: default
spec:
  parentRefs:
    - name: web-gateway
      namespace: default
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /
      backendRefs:
        - name: web-service
          port: 80
          weight: 80
        - name: web-service-v2
          port: 80
          weight: 20

Reference: https://gateway-api.sigs.k8s.io/api-types/httproute/