istio - 如何让 lua envoy 过滤器在 istio 集群上工作?

标签 istio envoyproxy

我正在尝试让 lua envoy 过滤器与 istio 网关一起工作,但我添加到集群并且它正在工作,就好像过滤器不存在一样。

我已经使用本指南在 GKE 上配置了我的 istio 集群 https://istio.io/docs/setup/kubernetes/install/kubernetes/ .

有人遇到同样的问题吗?

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: edge-lua-filter
spec:
  workloadLabels:
    app: httpbin-gateway
  filters:
  - listenerMatch:
      listenerType: GATEWAY
    filterName: envoy.lua
    filterType: HTTP
    filterConfig:
      inlineCode: |
        -- Called on the request path.
        function envoy_on_request(request_handle)
            request_handle:headers():add("foo", "bar")
        end
        -- Called on the response path.
        function envoy_on_response(response_handle)
            body_size = response_handle:body():length()
            response_handle:headers():add("response-body-size", tostring(body_size))
        end
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: httpbin-gateway
  namespace: foo
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: httpbin
  namespace: foo
spec:
  hosts:
  - "*"
  gateways:
  - httpbin-gateway
  http:
  - route:
    - destination:
        port:
          number: 8000
        host: httpbin.foo.svc.cluster.local

最佳答案

您正在将过滤器应用于 GATEWAY。入口网关的“app”名称是“istio-ingressgateway”,而不是“httpbin-gateway”

你有两个选择:

  1. 更改工作负载标签
  workloadLabels:
    app: istio-ingressgateway

  1. 删除工作负载标签。 Istio 会自动将更改应用到 GATEWAY pod

关于istio - 如何让 lua envoy 过滤器在 istio 集群上工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55595039/

相关文章:

istio - 将 K8s Ingress 与 Istio 网关结合使用?

kubernetes - 如何将 Pod 导出流量限制为仅限外部

nginx - 使用 Istio 在两个 pod 之间进行简单的 http 请求

node.js - 未见特使

envoyproxy - 用于路由到 envoy 中同一集群的多个前缀匹配

docker - 使用istio envoy代理运行的容器的最大Websocket连接数

kubernetes - Istio-使用DNS名称访问外部数据库(TCP)

kubernetes - 简单入门 Istio Helm 安装

kubernetes - 如何管理资源匮乏的Istio默认/SDS安装?

reverse-proxy - Envoy "http_connection_manager"设置问题