Kubernetes Services GRPCRoute API

GRPCRoute resources defining gRPC routing rules from Gateway listeners to backend services with service and method name matching.

OpenAPI Specification

kubernetes-services-grpcroute-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Kubernetes Services Kubernetes EndpointSlices GRPCRoute API
  description: The Kubernetes EndpointSlices API tracks the IP addresses, ports, readiness, and topology information for Pods backing a Service. EndpointSlices replaced the older Endpoints API to improve scalability for large clusters with thousands of pods. A single Service may be backed by multiple EndpointSlices, and the EndpointSlice controller automatically manages their lifecycle in response to pod and Service changes.
  version: v1.32.0
  contact:
    name: Kubernetes Community
    url: https://kubernetes.io/community/
  termsOfService: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://kubernetes.default.svc
  description: In-cluster Kubernetes API Server
security:
- bearerAuth: []
- clientCertificate: []
tags:
- name: GRPCRoute
  description: GRPCRoute resources defining gRPC routing rules from Gateway listeners to backend services with service and method name matching.
paths:
  /apis/gateway.networking.k8s.io/v1/namespaces/{namespace}/grpcroutes:
    get:
      operationId: listNamespacedGRPCRoutes
      summary: Kubernetes Services List GRPCRoutes in a namespace
      description: Returns a list of all GRPCRoute resources in the specified namespace. GRPCRoutes define gRPC routing rules matching on service and method names.
      tags:
      - GRPCRoute
      parameters:
      - $ref: '#/components/parameters/NamespaceParam'
      - $ref: '#/components/parameters/LabelSelector'
      - $ref: '#/components/parameters/Limit'
      - $ref: '#/components/parameters/Watch'
      responses:
        '200':
          description: List of GRPCRoute resources
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GRPCRouteList'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createNamespacedGRPCRoute
      summary: Kubernetes Services Create a GRPCRoute
      description: Creates a new GRPCRoute in the specified namespace for routing gRPC traffic from a Gateway listener to backend services based on gRPC service and method names.
      tags:
      - GRPCRoute
      parameters:
      - $ref: '#/components/parameters/NamespaceParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GRPCRoute'
      responses:
        '201':
          description: GRPCRoute created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GRPCRoute'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    GRPCRouteList:
      type: object
      description: A list of GRPCRoute resources.
      required:
      - items
      properties:
        apiVersion:
          type: string
        kind:
          type: string
          const: GRPCRouteList
        metadata:
          $ref: '#/components/schemas/ListMeta'
        items:
          type: array
          items:
            $ref: '#/components/schemas/GRPCRoute'
    ObjectMeta:
      type: object
      description: Standard Kubernetes object metadata.
      properties:
        name:
          type: string
          description: Name of the object.
        namespace:
          type: string
          description: Namespace of the object.
        uid:
          type: string
          description: Unique server-assigned identifier.
        resourceVersion:
          type: string
          description: Internal version string.
        creationTimestamp:
          type: string
          format: date-time
          description: Creation timestamp.
        labels:
          type: object
          additionalProperties:
            type: string
          description: Label key-value pairs.
        annotations:
          type: object
          additionalProperties:
            type: string
          description: Non-identifying metadata.
    Status:
      type: object
      description: Error or result status.
      properties:
        code:
          type: integer
        message:
          type: string
        reason:
          type: string
        status:
          type: string
          enum:
          - Success
          - Failure
    GRPCRoute:
      type: object
      description: A GRPCRoute defines gRPC routing rules from Gateway listeners to backend services, matching on gRPC service and method names for targeted traffic distribution.
      properties:
        apiVersion:
          type: string
          const: gateway.networking.k8s.io/v1
        kind:
          type: string
          const: GRPCRoute
        metadata:
          $ref: '#/components/schemas/ObjectMeta'
        spec:
          type: object
          properties:
            parentRefs:
              type: array
              description: Gateway listeners this route attaches to.
              items:
                type: object
                properties:
                  name:
                    type: string
                  namespace:
                    type: string
            hostnames:
              type: array
              description: Hostnames that should match for this route.
              items:
                type: string
            rules:
              type: array
              description: gRPC routing rules.
              items:
                type: object
                properties:
                  matches:
                    type: array
                    items:
                      type: object
                      properties:
                        method:
                          type: object
                          properties:
                            service:
                              type: string
                              description: gRPC service name to match.
                            method:
                              type: string
                              description: gRPC method name to match.
                            type:
                              type: string
                              enum:
                              - Exact
                              - RegularExpression
                  backendRefs:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        namespace:
                          type: string
                        port:
                          type: integer
                        weight:
                          type: integer
    ListMeta:
      type: object
      description: Metadata for list responses.
      properties:
        resourceVersion:
          type: string
        continue:
          type: string
        remainingItemCount:
          type: integer
  parameters:
    LabelSelector:
      name: labelSelector
      in: query
      description: Label selector to filter resources.
      schema:
        type: string
    Watch:
      name: watch
      in: query
      description: If true, stream watch events.
      schema:
        type: boolean
    NamespaceParam:
      name: namespace
      in: path
      required: true
      description: Namespace name to scope the request.
      schema:
        type: string
    Limit:
      name: limit
      in: query
      description: Maximum number of items to return.
      schema:
        type: integer
        minimum: 1
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Status'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Status'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Kubernetes service account or user bearer token.
    clientCertificate:
      type: mutualTLS
      description: Client TLS certificate signed by the cluster CA.
externalDocs:
  description: Kubernetes EndpointSlice API Reference
  url: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/