首页 > 其他分享 >Istio-learning-note-About-Gateway API(一)

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

时间:2024-04-06 16:30:11浏览次数:21  
标签:About HTTPRoute Gateway Istio bookinfo note API path gateway

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.

标签:About,HTTPRoute,Gateway,Istio,bookinfo,note,API,path,gateway
From: https://blog.csdn.net/weixin_46510209/article/details/137377751

相关文章

  • Apple iWork (Pages、Numbers、Keynote) 14.0 - 文档、电子表格、演示文稿
    AppleiWork(Pages、Numbers、Keynote)14.0-文档、电子表格、演示文稿请访问原文链接:AppleiWork(Pages、Numbers、Keynote)14.0-文档、电子表格、演示文稿,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org苹果今天将其专为iOS和macOS设备设计的iWork应......
  • postgresql make check报postgres.lto.o:(.note.stapsdt+0x4ac): undefined reference
    如下:/usr/bin/ld:postgres.lto.o:(.note.stapsdt+0x24):undefinedreferenceto`postgresql_statement__status_semaphore'/usr/bin/ld:postgres.lto.o:(.note.stapsdt+0x74):undefinedreferenceto`postgresql_deadlock__found_semaphore'/usr/bin/ld:p......
  • run Python asyncio code in a Jupyter notebook
     NewJupyterlab/notebookimportasyncioimporttimeasyncdefmy_coroutine():awaitasyncio.sleep(1)print("Coroutineexecuted!")s=time.perf_counter()loop=asyncio.get_event_loop()loop.create_task(my_coroutine())asyncio.r......
  • Notes-02年Fan-2002-Analysis of guided resonances in photonic crystal slabs-BIC的
    Notes-02年Fan-2002-Analysisofguidedresonancesinphotoniccrystalslabs目录Notes-02年Fan-2002-Analysisofguidedresonancesinphotoniccrystalslabs共振的含义就是:在光锥内,发光、辐射。引言guidedmodeguidedmoderesonance--Similartotheguidedmode,a......
  • envoy&istio 对接ratelimit 实现限流之envoy配置
    envoy与ratelimit对接需要完成两步,1启用ratelimit过滤器,2配置触发条件。一、启用ratelimit过滤器envoy要与ratelimit服务对接,需要在lds的http_filter配置上启用ratelimitfilter,启用方式如下1http_filters:2-name:envoy.filters.http.ratelimit......
  • 在Jupyter Notebook中导入Anaconda创建的虚拟环境
    如果你有虚拟环境,你就直接激活虚拟环境。没有虚拟环境,你就百度创建一个虚拟环境。在base环境下,输入下列指令,激活要导入到JupyterNotebook的虚拟环境activateyour-env-name一定要保证在不是base环境,是在你导入到JupyterNotebook的虚拟环境下。比如我的,前面就是我要导入的虚拟......
  • 莫名其妙的好了jupyternotebook
    莫名其妙的,我下载了一个python3.5然后发现原来的pythin3.11环境还在,然后我有切换回去了,在意运行就好了重新下载了jupyternotebook5.6.7jupyter切换环境以及到后台服务的连接没能建立,处理方法_jupyterlab不能切后台-CSDN博客没试过这个但是感觉有用我当时用了一个博主的......
  • [置顶] About Me & 博客迁移
    AboutMeName:lhyAge:13School:泰州二附中(好大众)我的Atcoder账号:Rainypaster,Luogu账号:Rainypaster。获奖记录:CSPJ1一等,J2二等,图形化创意编程大赛国金,以及一堆市里的小比赛一等。MyDream?华科大CSPS2、NOIP一等竞赛:信竞、数竞、物竞(初中会......
  • 在centos7虚拟机上通过jupyter、notebook实现波士顿房产预测
    一、环境搭建anaconda环境搭建:参考连接:CentOS7上安装Anaconda详细教程_centos7安装anaconda-CSDN博客首先在centos7上安装Anaconda,使用清华源下载Anaconda:wget--user-agent="Mozilla"https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2023.09-......
  • 使用.NET Interactive Notebook探索代码
    注意,已被更名为PolyglotNotebooks询问了常见AI对此掌握情况,一言、通义认为和图像数据相关,混元了解一些但不多,GitHubCopilot不知其已改名......