Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
Yandex Application Load Balancer
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Target groups
      • Create a target group
      • Edit a target group
      • Delete a target group
    • Backend groups
      • Create a backend group
      • Edit a backend group
      • Delete a backend group
    • HTTP routers
      • Create HTTP router for HTTP traffic
      • Create HTTP router for gRPC traffic
      • Edit an HTTP router
      • Delete an HTTP router
    • L7 load balancers
      • Create an L7 load balancer
      • Edit an L7 load balancer
      • View L7 load balancer statistics
      • View the L7 load balancer logs
      • Get the ID of the log group of the L7 load balancer
      • Stopping and restarting an L7 load balancer
      • Delete an L7 load balancer
    • Tools for Managed Service for Kubernetes
      • Install an Ingress controller
      • Install a Gateway API
      • Create or update resources based on configuration
  • Practical guidelines
    • All practical guidelines
    • Setting up a virtual hosting
    • Creating a load balancer with DDoS protection
    • Integrating an L7 load balancer with the CDN and Object Storage
    • Blue-green and canary deployment of service versions
    • Terminating TLS connections
    • Writing load balancer logs to PostgreSQL
    • Deploying and load testing a gRPC service with scaling
  • Concepts
    • Overview
    • Load balancers
    • HTTP routers
    • Backend groups
    • Target groups
    • Quotas and limits
  • Tools for Managed Service for Kubernetes
    • Ingress controller
      • Overview
      • How it works
    • Gateway API
    • Required settings
      • Security groups
      • Service accounts
  • Access management
  • Pricing policy
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • BackendGroupService
      • HttpRouterService
      • LoadBalancerService
      • TargetGroupService
      • VirtualHostService
      • OperationService
    • REST
      • Overview
      • BackendGroup
        • Overview
        • addBackend
        • create
        • delete
        • get
        • list
        • listOperations
        • removeBackend
        • update
        • updateBackend
      • HttpRouter
        • Overview
        • create
        • delete
        • get
        • list
        • listOperations
        • update
      • LoadBalancer
        • Overview
        • addListener
        • addSniMatch
        • create
        • delete
        • get
        • getTargetStates
        • list
        • listOperations
        • removeListener
        • removeSniMatch
        • start
        • stop
        • update
        • updateListener
        • updateSniMatch
      • TargetGroup
        • Overview
        • addTargets
        • create
        • delete
        • get
        • list
        • listOperations
        • removeTargets
        • update
      • VirtualHost
        • Overview
        • create
        • delete
        • get
        • list
        • removeRoute
        • update
        • updateRoute
  • Managed Service for Kubernetes tool references
    • Overview
    • Ingress controller
      • Ingress
      • HttpBackendGroup
    • Gateway API
      • Gateway
      • HTTPRoute
    • Service
  • Log reference
  1. Tools for Managed Service for Kubernetes
  2. Gateway API

Gateway API for Managed Service for Kubernetes

Written by
Yandex Cloud
  • Sample configuration
  • Installation and requirements

Note

Gateway API is in the Preview stage.

Application Load Balancer provides the Gateway API as a tool to create and manage load balancers in Yandex Managed Service for Kubernetes clusters. For more information about the Gateway API project, visit its website.

Once you install the Gateway API, you can use it to create a resource named Gateway and associated HTTPRoute resources:

  • The Gateway resource is managed by the cluster operator. This resource describes how incoming traffic is received and the rules for selecting routes for the traffic (HTTPRoute resources). To receive traffic through Gateway, an L7 load balancer is created. To route the traffic, HTTP routers are linked to the load balancer.
  • The HTTPRoute resources are managed by the developers of applications — Kubernetes services. HTTPRoute is a description of the route for the incoming traffic received. Based on this description, the traffic can be routed to Kubernetes that serves as a backend or redirected to another URI. The HTTPRoute is used to create virtual hosts and routes in HTTP routers and backend groups.

Sample configuration

Below is a sample configuration of Gateway and HTTPRoute resources. It will be used to create a load balancer to receive HTTPS traffic and to distribute it to two services based on the URI request path.

Example
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
  name: alb-gwapi-gw
spec:
  gatewayClassName: yc-df-class
  listeners:
    - name: alb-gwapi-listener
      protocol: HTTPS
      port: 443
      hostname: <domain_name>
      allowedRoutes:
        namespaces:
          from: Selector
          selector:
            matchLabels:
              gatewayName: alb-gwapi-gw
      tls:
        certificateRefs:
          - kind: Secret
            group: ""
            name: alb-gwapi-cert
            namespace: alb-gwapi-ns
---
apiVersion: v1
kind: Namespace
metadata:
  name: alb-gwapi-apps-ns
  labels:
    gatewayName: alb-gwapi-gw

---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
  name: alb-gwapi-route
  namespace: alb-gwapi-apps-ns
spec:
  hostnames:
    - "<domain_name>"
  parentRefs:
    - name: alb-gwapi-gw
      namespace: default
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /app1
      backendRefs:
        - name: alb-demo-1
          port: 80
    - matches:
        - path:
            type: PathPrefix
            value: /app2
      backendRefs:
        - name: alb-demo-2
          port: 80
    - backendRefs: # Default match (implicit "/" path prefix)
        - name: alb-demo-2
          port: 80

Installation and requirements

To install the Gateway API, you need:

  • Managed Service for Kubernetes cluster.
  • Cluster node group.
  • A cluster namespace to store the service account key.

You can install the Gateway API:

  • As a Yandex Cloud Marketplace product using the management console.

  • As a chart using the Helm package manager, version 3.7.0 or higher with OCI support enabled. To download and install a chart, run:

    export HELM_EXPERIMENTAL_OCI=1 && \
    helm pull oci://cr.yandex/yc-marketplace/yandex-cloud/gateway-api/gateway-api-helm/gateway-api \
      --version 0.4.16 \
      --untar && \
    helm install \
      --namespace <namespace> \
      --set folderId=<folder_ID> \
      --set networkId=<network_ID> \
      --set subnetId=<subnet_ID> \
      --set-file saKeySecretKey=<path_to_file_with_service_account_key> \
      yc-alb-gateway-api ./yc-alb-gateway-api-chart/
    

For more information about each option, please see the complete installation instructions.

See also

  • Security group configuration for a Kubernetes cluster and a load balancer.
  • Service account to support controller operation.

Was the article helpful?

Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
In this article:
  • Sample configuration
  • Installation and requirements