1

我正在尝试通过 Istio HTTPS->配置 TLS 终止HTTP

HTTP80 工作正常。

HTTPS443 仅适用于/路径。

HTTP 200:

curl https://serviceA.example.com

HTTP 404:

curl https://serviceA.example.com/blabla

Istio 访问日志:

GET /blabla HTTP/2" 404 NR route_not_found

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: serviceA-gateway
  namespace: default
spec:
  selector:
    istio: ingressgateway
  servers:
    - port:
        number: 80
        name: HTTP
        protocol: HTTP
      hosts:
        - "serviceA.example.com"
    - port:
        number: 443
        name: https
        protocol: HTTPS
      tls:
        mode: SIMPLE
        credentialName: serviceA.example.com
      hosts:
        - "*"

---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: serviceA-swearl
  namespace: default
spec:
  hosts:
    - serviceA.example.com
  gateways:
    - serviceA-gateway
  HTTP:
    - route:
        - destination:
            host: serviceA.default.svc.cluster.local
            port:
              number: 80

我不确定我做错了什么。通过查看文档,一切都应该正常工作。设置是带有 NLB 的 AWS EKS 上的 ISTIO 操作员。

另外,我在 istio-system 命名空间中有一个证书-机密。服务和部署具有必需的标签。

FIX:问题在于我对 Ingress 的定义

pathType: ImplementationSpecific

它应该是:

pathType: Prefix

配置 Ingress pathType ImplementationSpecific 行为 #26883

4

1 回答 1

0

社区 wiki 回答以获得更好的可见性。

正如问题中提到的OP,问题是通过设置解决的

pathType: Prefix

在入口处。

原始信息:

FIX:问题在于我对 Ingress 的定义

pathType: ImplementationSpecific

应该是pathType: Prefix https://github.com/istio/istio/issues/26883

你可以在这个官方文档中找到解释:

Ingress 中的每条路径都需要具有相应的路径类型。不包含显式的路径 pathType 将无法通过验证。支持三种路径类型:

  • ImplementationSpecific: 使用这种路径类型,匹配取决于 IngressClass。实现可以将其视为单独的 pathType 或将其视为与 Prefix 路径 Exact 类型相同。

  • Exact: 完全匹配 URL 路径并且区分大小写。

  • Prefix: 基于由 . 分隔的 URL 路径前缀匹配 /。匹配区分大小写,并在逐个元素的路径元素基础上完成。路径元素是指由 / 分隔符分割的路径中的标签列表。 如果每个 p都是请求路径的p 的元素前缀, 则请求是路径p的匹配 项 。

于 2021-10-04T12:03:56.803 回答