Skip to content
You are viewing the latest documentation for Solo Enterprise for kgateway. To access the documentation for older versions, use the version switcher.

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Kubernetes services

Page as Markdown

Reference a Kubernetes Service directly from an HTTPRoute as the backend for a route.

Route traffic to an HTTP or HTTPS Kubernetes service.

You can route to a Kubernetes service by referencing that service in the backendRefs section of your HTTPRoute resource as shown in the following example.

Note

Most guides in this documentation route traffic to a Kubernetes service directly. If you want to route to external resources, such as a static hostname or AWS resource, create a Backend resource.

k8s-service-httproute.yaml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: kube-backend
  namespace: default
spec:
  parentRefs:
  - name: http
    namespace: kgateway-system
  hostnames:
    - httpbin.example.com
  rules:
    - backendRefs:
      - name: httpbin
        port: 8000
      filters:
      - type: ExtensionRef
        extensionRef:
          group: gateway.kgateway.dev
          kind: TrafficPolicy
          name: rewrite

Was this page helpful?