Istio是否支持代理协议?

时间:2018-10-23 07:55:18

标签: kubernetes haproxy istio proxy-protocol

Istio是否支持代理协议?

我在具有TCP转发和代理协议(“ send-proxy”标志)的haproxy后面设置了网关,但是它不起作用。

我知道Envoy支持它,但Istio似乎不支持。

如果不支持,是否还有另一种方法来检索源IP?

感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

您可能必须应用以下内容:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: proxy-protocol
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      istio: ingressgateway
  configPatches:
  - applyTo: LISTENER
    patch:
      operation: MERGE
      value:
        listener_filters:
        - name: envoy.listener.proxy_protocol
        - name: envoy.listener.tls_inspector

由于我的istio入口网关位于AWS ELB的后面,因此我还必须在ELB上启用代理协议:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  namespace: istio-system
spec:
  profile: default
  components:
    ingressGateways:
      - name: istio-ingressgateway
        namespace: istio-system
        enabled: true
        # Copy settings from istio-ingressgateway as needed.
  values:
    gateways:
      istio-ingressgateway:
        serviceAnnotations:
          # Note that Helm values (spec.values.gateways.istio-ingressgateway/egressgateway)
          # are shared by all ingress/egress gateways.
          # If these must be customized per gateway,
          # it is recommended to use a separate IstioOperator CR

          # Enable Prox protocol
          service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*"

如果您会错过envoy.listener.tls_inspector,则会得到:

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to xxx
openssl: no peer certificate available