我正在尝试让 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”
你有两个选择:
- 更改工作负载标签
workloadLabels:
app: istio-ingressgateway
或
- 删除工作负载标签。 Istio 会自动将更改应用到 GATEWAY pod
关于istio - 如何让 lua envoy 过滤器在 istio 集群上工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55595039/