Kubernetes services

Route traffic to a Kubernetes service.

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

ℹ️
Most guides in this documentation route traffic to a Kubernetes service directly. If you want to configure additional settings for your Kubernetes service, such as the HTTP/2 protocol or a different load balancing algorithm, use an Upstream resource as your backing destination instead. For more information, see Upstreams.
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/v1beta1
kind: HTTPRoute
metadata:
  name: static-upstream
  namespace: default
spec:
  parentRefs:
  - name: http
    namespace: gloo-system
  hostnames:
    - static.example
  rules:
    - backendRefs:
      - name: httpbin
        port: 8000
      filters:
      - type: ExtensionRef
        extensionRef:
          group: gateway.solo.io
          kind: RouteOption
          name: rewrite