Istio-learning-note-About-Gateway API(一)

Polished Notes on New Kubernetes Gateway API

I. Understanding Gateway API in Istio

  1. Gateway Class: This resource defines the provider of the Gateway control plane pod.

    • Think of it as a template specifying which implementation (e.g., Istio, Nginx) will handle gateway functionality.
  2. Gateway: This resource configures network traffic listener aspects.

    • It defines which port and protocol (e.g., port 80, protocol HTTP) the gateway should listen on.
  3. HTTPRoute: This resource associates with a specific Gateway and defines routing rules for incoming HTTP traffic.

    • It specifies how to route requests based on paths (e.g., /productpage) to backend services.

II. FAQ

A. Difference between Ingress Controller and Gateway API/Istio Ingress Gateway

  • Ingress Controller: Manages ingress for the entire Kubernetes cluster. It's often used with a single host network for multiple services.
  • Gateway API/Istio Ingress Gateway: Provides fine-grained control for individual applications and microservices. Each application can have its own Gateway and each microservice can have its own HTTPRoute for routing. They offer more separation of concerns.

B. Work and Contact Surface

  • Ingress Controller:

    • Infrastructure engineers typically manage the ingress controller itself (e.g., Nginx).
    • Application developers configure ingress resources to define how to expose services externally.
  • Gateway API:

    • Infrastructure engineers create GatewayClass resources specifying gateway implementations.
    • Cluster managers configure Gateway resources with details like domain, port, and allowed namespaces.
    • Application developers define HTTPRoute resources to specify routing rules for their microservices.

Example: Bookinfo Gateway Configuration

Gateway (bookinfo-gateway.yaml):

YAML

apiVersion: v1
items:
- apiVersion: gateway.networking.k8s.io/v1
  kind: Gateway
  name: bookinfo-gateway
  namespace: bookinfo
  spec:
    gatewayClassName: istio  # Uses the "istio" GatewayClass
    listeners:
    - allowedRoutes:
        namespaces:
          from: All  # Allows traffic from any namespace
      name: http
      port: 80
      protocol: HTTP

HTTPRoute (bookinfo.yaml):

YAML

apiVersion: v1
items:
- apiVersion: gateway.networking.k8s.io/v1
  kind: HTTPRoute
  name: bookinfo
  namespace: bookinfo
  spec:
    parentRefs:
    - group: gateway.networking.k8s.io
      kind: Gateway
      name: bookinfo-gateway  # Attaches to the bookinfo-gateway
    rules:
    - backendRefs:
        - group: ""  # Refers to a Service resource
          kind: Service
          name: productpage
          port: 9080
          weight: 1  # Weight for load balancing
      matches:
      - path:
          type: Exact
          value: /productpage  # Route for /productpage path
        - path:
          type: PathPrefix
          value: /static  # Route for paths starting with /static
        - path:  # Additional route examples
          type: Exact
          value: /login
        - path:
          type: Exact
          value: /logout
        - path:
          type: PathPrefix
          value: /api/v1/products

Key Points:

  • Gateway API offers more granular control over traffic management compared to a single ingress controller.
  • HTTPRoutes enable flexible routing based on path prefixes or exact paths.
  • You can configure weights for backend services in HTTPRoutes for load balancing.

相关推荐

  1. Istio-learning-note-About-Gateway API(

    2024-04-05 15:52:04       39 阅读
  2. Istio-learning-note-about-Fault Injection(二)

    2024-04-05 15:52:04       33 阅读
  3. Istio-learning-note-about-Traffic Shifting(三)

    2024-04-05 15:52:04       42 阅读
  4. Talking About Your Ideas - English Lesson Notes

    2024-04-05 15:52:04       42 阅读
  5. Statistical signal processing exam learning notes(Aalto)

    2024-04-05 15:52:04       43 阅读
  6. About MATLAB

    2024-04-05 15:52:04       37 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-05 15:52:04       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-05 15:52:04       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-05 15:52:04       87 阅读
  4. Python语言-面向对象

    2024-04-05 15:52:04       96 阅读

热门阅读

  1. 线程和进程的区别?

    2024-04-05 15:52:04       39 阅读
  2. Linux升级openssl至openssl-1.1.1版本

    2024-04-05 15:52:04       39 阅读
  3. 如何在运行时或以编程方式生成testng.xml

    2024-04-05 15:52:04       33 阅读
  4. Spirngboot JWT快速配置和使用

    2024-04-05 15:52:04       38 阅读
  5. 有关在运行时生成testng.xml的更多信息

    2024-04-05 15:52:04       32 阅读
  6. zookeeper之基本命令

    2024-04-05 15:52:04       40 阅读
  7. 蒟蒻求助帖

    2024-04-05 15:52:04       33 阅读
  8. 微信小程序 ---- 慕尚花坊 订单列表

    2024-04-05 15:52:04       39 阅读
  9. Android 关机充电动画卡住无反应,也不灭屏

    2024-04-05 15:52:04       39 阅读
  10. 【递推与递归】python例题详解

    2024-04-05 15:52:04       35 阅读