### Ingress конфигурация для Application Load Balancer Source: https://yandex.cloud/docs/application-load-balancer/tools/gwin Пример конфигурации с использованием ресурса Ingress. Создает балансировщик с динамическим публичным IP, принимает HTTP на порту 80 и HTTPS на порту 443 с сертификатом, отправляет GET-запросы к сервису example-service. ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: example-ingress namespace: example-ns annotations: gwin.yandex.cloud/groupName: example gwin.yandex.cloud/externalIPv4Address: auto gwin.yandex.cloud/rules.allowedMethods: "GET" spec: ingressClassName: gwin-default rules: - host: example.com http: paths: - pathType: Prefix path: "/api" backend: service: name: example-service port: number: 80 tls: - hosts: - example.com secretName: "yc-certmgr-cert-id-<идентификатор_сертификата>" ``` -------------------------------- ### Gateway API конфигурация для Application Load Balancer Source: https://yandex.cloud/docs/application-load-balancer/tools/gwin Пример конфигурации с использованием ресурсов Gateway API: Gateway, HTTPRoute для редиректа, HTTPRoute для маршрутизации и YCCertificate. Создает балансировщик с динамическим публичным IP, принимает HTTP на порту 80 и HTTPS на порту 443 с сертификатом. ```yaml apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: example-gateway namespace: example-ns spec: gatewayClassName: gwin-default listeners: - name: http protocol: HTTP port: 80 hostname: "example.com" allowedRoutes: namespaces: from: Same - name: https protocol: HTTPS port: 443 hostname: "example.com" allowedRoutes: namespaces: from: Same tls: certificateRefs: - group: gwin.yandex.cloud kind: YCCertificate name: example-certificate addresses: - type: gwin.yandex.cloud/autoIPv4 value: auto --- apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: example-redirect-httproute namespace: example-ns spec: hostnames: - "example.com" parentRefs: - name: example-gateway sectionName: http rules: - filters: - type: RequestRedirect requestRedirect: scheme: https statusCode: 301 --- apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: example-httproute namespace: example-ns spec: hostnames: - "example.com" parentRefs: - name: example-gateway sectionName: https rules: - matches: - path: value: /api type: PathPrefix method: GET backendRefs: - kind: Service name: example-service port: 80 --- apiVersion: gwin.yandex.cloud/v1 kind: YCCertificate metadata: name: example-certificate namespace: example-ns spec: certificateRef: certificateID: "<идентификатор_сертификата>" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.