【问题标题】:ISTIO HTTPS-HTTP 404 NR route_not_foundISTIO HTTPS-HTTP 404 NR route_not_found
【发布时间】:2021-11-24 17:41:16
【问题描述】:

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

HTTP 80 工作正常。

HTTPS 443 仅适用于/ 路径。

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 命名空间中有一个证书 - secret。 Service 和 Deployment 有必需的标签。

修复:问题在于我在 Ingress 定义上遇到了问题

pathType: ImplementationSpecific

应该是:

pathType: Prefix

Configure Ingress pathType ImplementationSpecific behavior #26883

【问题讨论】:

    标签: http https istio istio-operator


    【解决方案1】:

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

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

    pathType: Prefix
    

    在入口中。

    原文:

    修复:问题在于我在 Ingress 定义上遇到了问题

    pathType: ImplementationSpecific
    
    

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

    你可以在这个official documentation找到解释:

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

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

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

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

    【讨论】:

      猜你喜欢
      • 2021-07-12
      • 1970-01-01
      • 2020-03-08
      • 1970-01-01
      • 2016-06-18
      • 2019-12-12
      • 1970-01-01
      • 2014-12-06
      • 2020-10-21
      相关资源
      最近更新 更多