我们已经在 GCP 中创建了 knative serverless 应用程序我们正在尝试使用 istio 网格访问它

问题描述

但是我们在访问 API 时收到状态代码 404。

实施以下步骤:

  1. 将域 URL 指向 istio 负载均衡器外部 IP。
  2. 应用了一个将其路由目的地映射到 istio-ingressgateway.istio-system.svc.cluster.local 的 VirtualService

Yaml 文件

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
Metadata:
  name: entry-route
  namespace: vulcan
spec:
  # gateways:
  # - istio-ingressgateway.istio-system.svc.cluster.local
  hosts:
  - ktest.xxx.com
  http:
  - match:
    - uri:
        prefix: "/atlas/*"
    rewrite:
      authority: k-atlas-service.vulcan.xxx.com
    route:
      - destination:
          host: istio-ingressgateway.istio-system.svc.cluster.local
        weight: 100

解决方法

你试过Domain Mapping API吗?该 API 旨在使这项任务在不同的 Knative 网络实现中更轻松、更一致。

如果该 API 不可用,these instructions for Istio 可能会提供一个工作示例。我怀疑您可能需要在上面发布的 VirtualService 中定位 Knative-internal VirtualService 或 Knative Service 的内部 URL。