OpenMCF logoOpenMCF

Loading...

Kubernetes gRPC Route

Provision a Kubernetes Gateway API GRPCRoute -- namespaced gRPC routing rules that attach to a Gateway and forward matching requests to backend Services. Match by hostname, gRPC service/method, or header; transform with filters; and split traffic across weighted backends.

What Gets Created

  • A namespaced gateway.networking.k8s.io/v1 GRPCRoute custom resource.
  • One or more rules, each with matches, optional filters, and backend refs.
  • Optional per-rule and per-backend filters (header modification, request mirror, or an implementation-specific extension).

Prerequisites

  • Gateway API CRDs installed on the cluster (KubernetesGatewayApiCrds).
  • A Gateway to attach to via parentRefs (KubernetesGateway) whose listener accepts HTTP/2 (gRPC requires HTTP/2; over HTTP this is h2c).
  • The target namespace (KubernetesNamespace).
  • The backend gRPC Services the route forwards to.

Quick Start

apiVersion: kubernetes.openmcf.org/v1
kind: KubernetesGrpcRoute
metadata:
  name: greeter-route
spec:
  namespace:
    value: app-ns
  parentRefs:
    - name: my-gateway
  hostnames:
    - api.example.com
  rules:
    - matches:
        - method:
            service: helloworld.Greeter
      backendRefs:
        - name: greeter
          port: 9000
openmcf apply -f grpcroute.yaml

Configuration Reference

Required Fields

FieldTypeDescription
namespacereferenceNamespace to create the route in.
ruleslistAt least one routing rule.

Optional Fields

FieldTypeDescription
parentRefslistGateways (and optional listener sectionName) the route attaches to.
hostnameslistAuthority (Host) values that select this route.
rules[].matcheslistMethod (service/method) and header matchers.
rules[].filterslistHeader modify, request mirror, extension ref.
rules[].backendRefslistWeighted backends to forward to.

Examples

Service/method routing

spec:
  namespace:
    value: app-ns
  parentRefs:
    - name: my-gateway
  hostnames:
    - api.example.com
  rules:
    - matches:
        - method:
            type: Exact
            service: helloworld.Greeter
            method: SayHello
      backendRefs:
        - name: greeter
          port: 9000

Weighted canary split

spec:
  namespace:
    value: app-ns
  parentRefs:
    - name: my-gateway
  hostnames:
    - api.example.com
  rules:
    - backendRefs:
        - name: greeter-stable
          port: 9000
          weight: 90
        - name: greeter-canary
          port: 9000
          weight: 10

Stack Outputs

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

Related Components

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

Next article

Kubernetes Harbor

Kubernetes Harbor Deploys Harbor cloud-native container registry on Kubernetes using the official Harbor Helm chart. Provisions separate Harbor Core, Portal, Registry, and Jobservice components with independent resource tuning. Supports self-managed or external PostgreSQL and Redis, multiple artifact storage backends (S3, GCS, Azure Blob, Alibaba OSS, filesystem), arbitrary Helm value overrides, and optional external access through Istio Gateway API ingress with TLS termination. What Gets...
Read next article
Presets
2 ready-to-deploy configurationsView presets →