OpenMCF logoOpenMCF

Loading...

Kubernetes TCP Route

Provision a Kubernetes Gateway API TCPRoute -- namespaced rules that forward raw TCP connections arriving on a Gateway listener to backend Services. A TCP route has no matching: connections on the listener's port are forwarded to the rule's backends. Use it to expose non-HTTP TCP services (databases, brokers, custom protocols) through a Gateway.

Experimental channel. TCPRoute is served as gateway.networking.k8s.io/v1alpha2 and requires the Gateway API experimental CRDs (KubernetesGatewayApiCrds with install_channel: experimental).

What Gets Created

  • A namespaced gateway.networking.k8s.io/v1alpha2 TCPRoute custom resource.
  • One or more rules (max 16), each forwarding to one or more weighted backend refs.

Prerequisites

  • Gateway API experimental-channel CRDs installed (KubernetesGatewayApiCrds with install_channel: experimental).
  • A Gateway to attach to via parentRefs (KubernetesGateway) with a TCP listener.
  • The target namespace (KubernetesNamespace).
  • The backend Services the route forwards to.

Quick Start

apiVersion: kubernetes.openmcf.org/v1
kind: KubernetesTcpRoute
metadata:
  name: postgres-route
spec:
  namespace:
    value: app-ns
  parentRefs:
    - name: my-gateway
      sectionName: tcp
  rules:
    - backendRefs:
        - name: postgres
          port: 5432
openmcf apply -f tcproute.yaml

Configuration Reference

Required Fields

FieldTypeDescription
namespacereferenceNamespace to create the route in.
ruleslistOne to 16 routing rules.

Optional Fields

FieldTypeDescription
parentRefslistGateways (and optional listener sectionName) the route attaches to.
useDefaultGatewaysstringAll or None -- experimental default-Gateway attachment.
rules[].namestringOptional rule name.
rules[].backendRefslistWeighted backends to forward to.

Examples

Port forwarding

spec:
  namespace:
    value: app-ns
  parentRefs:
    - name: my-gateway
      sectionName: tcp
  rules:
    - backendRefs:
        - name: postgres
          port: 5432

Weighted backends (canary)

spec:
  namespace:
    value: app-ns
  parentRefs:
    - name: my-gateway
      sectionName: tcp
  rules:
    - backendRefs:
        - name: broker-stable
          port: 9092
          weight: 90
        - name: broker-canary
          port: 9092
          weight: 10

Stack Outputs

OutputDescription
routeNameName of the created TCPRoute (equals metadata.name).
namespaceNamespace the TCPRoute was created in.

Related Components

  • Kubernetes Gateway
  • Kubernetes TLS Route
  • Kubernetes Gateway Class
  • Kubernetes Gateway API CRDs
  • Kubernetes Namespace

Next article

Kubernetes Tekton

Kubernetes Tekton Deploys Tekton Pipelines and optionally Tekton Dashboard on Kubernetes by applying official upstream release manifests directly, without requiring the Tekton Operator. This manifest-based approach gives direct control over component versions, is simpler to understand and debug, and supports optional CloudEvents integration for pipeline event notifications and external dashboard access through Istio Gateway API ingress with automatic TLS via cert-manager. What Gets Created When...
Read next article
Presets
2 ready-to-deploy configurationsView presets →