【问题标题】:Istio Multiple port number filed with single hostIstio 使用单个主机提交的多个端口号
【发布时间】:2021-05-18 20:45:40
【问题描述】:

Istio 入口网关如何使用多个端口字段选项编号与单个主机名 IP 地址。

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      name: nginx
      port: 80
      protocol: TCP
    hosts:
    - "https://ip-address1"
  - port:
      name: nodejs
      port: 449
      protocol: TCP
    hosts:
    - "https://ip-address1"

【问题讨论】:

    标签: kubernetes istio istio-gateway


    【解决方案1】:

    根据Gateway documentation,您需要将port 定义为servers 列表的单个项目的一部分。在同一个项目中指定hosts(顾名思义,您可以在此处指定许多不同的主机,实际上是它们的列表,因为每个主机都以单独的- 符号开头)。

    如果您想为同一主机再指定一个port,您可以简单地在另一个- port 项目的上下文中重复该主机的名称,例如here 示例。它不能以任何不同于官方规范中描述的方式来完成。

    ...
    spec:
      selector:
        app: my-gateway-controller
      servers:
      - port:
          number: 80
          name: http
          protocol: HTTP
        hosts:
        - uk.bookinfo.com
        - eu.bookinfo.com
        tls:
          httpsRedirect: true # sends 301 redirect for http requests
      - port:
          number: 443
          name: https-443
          protocol: HTTPS
        hosts:
        - uk.bookinfo.com
        - eu.bookinfo.com
        tls:
          mode: SIMPLE # enables HTTPS on this port
          serverCertificate: /etc/certs/servercert.pem
          privateKey: /etc/certs/privatekey.pem
    ...
    

    正如您在上面看到的,相同的主机是 http(端口 80)和 https(端口 443)配置的一部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-23
      • 2021-08-11
      • 2020-05-06
      相关资源
      最近更新 更多