【问题标题】:EnvoyFilter to exclude specific hostsEnvoyFilter 排除特定主机
【发布时间】:2023-03-16 11:50:01
【问题描述】:

我需要从 EnvoyFilter 中排除特定主机,如下所示:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: authn-filter
spec:
  workloadLabels:
    istio: ingressgateway
  filters:
  - filterConfig:
      httpService:
        serverUri:
          uri: http://authservice.$(namespace).svc.cluster.local
          cluster: outbound|8080||authservice.$(namespace).svc.cluster.local
          failureModeAllow: false
          timeout: 10s
        authorizationRequest:
          allowedHeaders:
            patterns:
            - exact: "cookie"
            - exact: "X-Auth-Token"
        authorizationResponse:
          allowedUpstreamHeaders:
            patterns:
            - exact: "kubeflow-userid"
      statusOnError:
        code: GatewayTimeout
    filterName: envoy.ext_authz
    filterType: HTTP
    insertPosition:
      index: FIRST
    listenerMatch:
      listenerType: GATEWAY

问题是过滤器适用于默认的 istio 入口网关,它会影响通过该网关的所有流量,我希望有一些主机可以从过滤器中排除/列入白名单。

【问题讨论】:

  • 我唯一发现的就是here,但我不确定它是否有效。也许您可以考虑将其从 istio 入口网关更改为特定的 pod 标签、命名空间,如 istio documentation 中提到的?
  • 您找到解决方案了吗?

标签: kubernetes istio


【解决方案1】:

我找到了我的答案here。这个问题要求排除一些路径,但我在主机方面也很成功。这是我用的:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: bypass-authn
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      istio: ingressgateway
  configPatches:
  - applyTo: HTTP_ROUTE
    match:
      routeConfiguration:
        vhost:
          name: subdomain.example.org:80 # <== your host goes here
    patch:
      operation: MERGE
      value:
        name: envoy.ext_authz_disabled
        typed_per_filter_config:
          envoy.ext_authz:
            "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
            disabled: true

Istio documentation 中的更多信息。具体来说,文档指定您还应该将端口放入name: 字段,但我认为没有它也应该工作。

【讨论】:

    猜你喜欢
    • 2019-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-28
    • 1970-01-01
    • 1970-01-01
    • 2022-07-09
    • 1970-01-01
    相关资源
    最近更新 更多