Skip to main content
The Route resource represents Layer 7 routing for Ingress and Gateway API resources. It contains information about the source resources and the endpoints that traffic should be routed to.

API Version

kubelb.k8c.io/v1alpha1

Spec Fields

endpoints
[]LoadBalancerEndpoints
required
Sets of addresses and ports that comprise an exposed user service on a cluster.Minimum items: 1
endpoints[].name
string
Name of the endpoint group.
endpoints[].addresses
[]EndpointAddress
IP addresses which offer the related ports that are marked as ready. These endpoints should be considered safe for load balancers and clients to utilize.Minimum items: 1. Ignored if addressesReference is set.
endpoints[].addresses[].ip
string
required
The IP of the endpoint. This can be an IPv4 or IPv6 address. The IP address must not be IP CIDR, Loopback (127.0.0.0/8), link-local (169.254.0.0/16), or link-local multicast (224.0.0.0/24) addresses.
endpoints[].addresses[].hostname
string
The hostname of this endpoint.
endpoints[].addressesReference
ObjectReference
Reference to an Addresses object that contains the IP addresses. If this field is set, the addresses field will be ignored.
endpoints[].ports
[]EndpointPort
Port numbers available on the related IP addresses. This field is ignored for routes that are using kubernetes resources as the source.Minimum items: 1
endpoints[].ports[].name
string
The name of this port. Must be a DNS_LABEL. Optional only if one port is defined.
endpoints[].ports[].port
int32
required
The port number of the endpoint.
endpoints[].ports[].protocol
Protocol
The IP protocol for this port. Defaults to “TCP”.Allowed values: TCP, UDP
source
RouteSource
Contains information about the source of the route. This is used when the route is created from external sources.
source.kubernetes
KubernetesSource
Contains information about the Kubernetes source. This field is automatically populated by the KubeLB CCM and in most cases, users should not set this field manually.
source.kubernetes.resource
Unstructured
The resource that is used as the source for the Route.Allowed resources:
  • networking.k8s.io/Ingress
  • gateway.networking.k8s.io/Gateway
  • gateway.networking.k8s.io/HTTPRoute
  • gateway.networking.k8s.io/GRPCRoute
source.kubernetes.services
[]Service
List of services that are used as the source for the Route. These are the upstream services that the route forwards traffic to.

Status Fields

resources
RouteResourcesStatus
Contains the list of resources that are created/processed as a result of the Route.
resources.source
string
Source resource identifier.
resources.services
map[string]RouteServiceStatus
Map of service statuses keyed by service name.
resources.services[*].apiVersion
string
API version of the service resource.
resources.services[*].kind
string
Kind of the service resource.
resources.services[*].name
string
Name of the service resource.
resources.services[*].namespace
string
Namespace of the service resource.
resources.services[*].generatedName
string
Generated name of the service resource.
resources.services[*].ports
[]ServicePort
List of service ports.
resources.services[*].status
RawExtension
Actual status of the service resource.
resources.services[*].conditions
[]Condition
Conditions of the service resource.
resources.route
ResourceState
State of the route resource.
resources.route.apiVersion
string
API version of the route resource.
resources.route.kind
string
Kind of the route resource.
resources.route.name
string
Name of the route resource.
resources.route.namespace
string
Namespace of the route resource.
resources.route.generatedName
string
Generated name of the route resource.
resources.route.status
RawExtension
Actual status of the route resource.
resources.route.conditions
[]Condition
Conditions of the route resource.

Example

Route from Ingress

apiVersion: kubelb.k8c.io/v1alpha1
kind: Route
metadata:
  name: example-route-ingress
  namespace: default
  labels:
    kubelb.k8c.io/origin-name: my-ingress
    kubelb.k8c.io/origin-ns: my-namespace
    kubelb.k8c.io/origin-resource-kind: Ingress
spec:
  endpoints:
    - name: my-endpoints
      addresses:
        - ip: 10.10.1.1
        - ip: 10.10.1.2
      ports:
        - name: http
          port: 30080
          protocol: TCP
  source:
    kubernetes:
      resource:
        apiVersion: networking.k8s.io/v1
        kind: Ingress
        metadata:
          name: my-ingress
          namespace: my-namespace
        spec:
          rules:
            - host: app.example.com
              http:
                paths:
                  - path: /
                    pathType: Prefix
                    backend:
                      service:
                        name: my-service
                        port:
                          number: 80
      services:
        - apiVersion: v1
          kind: Service
          metadata:
            name: my-service
            namespace: my-namespace
          spec:
            ports:
              - name: http
                port: 80
                targetPort: 8080
            selector:
              app: myapp
status:
  resources:
    source: Ingress/my-namespace/my-ingress
    services:
      my-service:
        apiVersion: v1
        kind: Service
        name: my-service
        namespace: default
        generatedName: my-service-generated
        ports:
          - name: http
            port: 80
            targetPort: 8080
    route:
      apiVersion: networking.k8s.io/v1
      kind: Ingress
      name: my-ingress
      namespace: default
      generatedName: my-ingress-generated

Route from HTTPRoute

apiVersion: kubelb.k8c.io/v1alpha1
kind: Route
metadata:
  name: example-route-httproute
  namespace: default
  labels:
    kubelb.k8c.io/origin-name: my-httproute
    kubelb.k8c.io/origin-ns: my-namespace
    kubelb.k8c.io/origin-resource-kind: HTTPRoute
spec:
  endpoints:
    - name: my-endpoints
      addressesReference:
        name: default
        namespace: default
  source:
    kubernetes:
      resource:
        apiVersion: gateway.networking.k8s.io/v1
        kind: HTTPRoute
        metadata:
          name: my-httproute
          namespace: my-namespace
        spec:
          parentRefs:
            - name: my-gateway
              namespace: gateway-system
          hostnames:
            - api.example.com
          rules:
            - matches:
                - path:
                    type: PathPrefix
                    value: /api
              backendRefs:
                - name: api-service
                  port: 8080
      services:
        - apiVersion: v1
          kind: Service
          metadata:
            name: api-service
            namespace: my-namespace
          spec:
            ports:
              - name: api
                port: 8080
                targetPort: 8080

Route from Gateway

apiVersion: kubelb.k8c.io/v1alpha1
kind: Route
metadata:
  name: example-route-gateway
  namespace: default
  labels:
    kubelb.k8c.io/origin-name: my-gateway
    kubelb.k8c.io/origin-ns: gateway-system
    kubelb.k8c.io/origin-resource-kind: Gateway
spec:
  endpoints:
    - name: gateway-endpoints
      addresses:
        - ip: 10.10.1.10
        - ip: 10.10.1.11
      ports:
        - name: http
          port: 80
          protocol: TCP
        - name: https
          port: 443
          protocol: TCP
  source:
    kubernetes:
      resource:
        apiVersion: gateway.networking.k8s.io/v1
        kind: Gateway
        metadata:
          name: my-gateway
          namespace: gateway-system
        spec:
          gatewayClassName: kubelb
          listeners:
            - name: http
              protocol: HTTP
              port: 80
            - name: https
              protocol: HTTPS
              port: 443
              tls:
                mode: Terminate
                certificateRefs:
                  - name: gateway-cert

Labels

kubelb.k8c.io/origin-name
string
Name of the original resource in the tenant cluster.
kubelb.k8c.io/origin-ns
string
Namespace of the original resource in the tenant cluster.
kubelb.k8c.io/origin-resource-kind
string
Kind of the original resource in the tenant cluster (e.g., Ingress, HTTPRoute, Gateway).

Build docs developers (and LLMs) love