首页 > 解决方案 > HAProxy 到 Istio 入口

问题描述

目前,我正在尝试配置一个负载均衡器,流量将从该负载均衡器发送到 Kubernetes 集群。在集群的边缘,Istio ingress 为集群的外部请求提供服务。HAProxy 1.8 版

我可以从集群外部使用以下命令访问该服务。

curl -k -HHost:httpbin.example.com --resolve httpbin.example.com:32009:192.168.50.10 https://httpbin.example.com:32009/status/418

下面是我的 HAProxy 配置:

前端:

frontend https
    bind *:443 ssl crt /etc/ssl/certs/site.pem
    mode tcp

    tcp-request inspect-delay 5s
    tcp-request content accept if { req_ssl_hello_type 1 }

    default_backend httpbin

后端:

  backend httpbin
    balance roundrobin
    mode tcp

    acl httpbin_app req_ssl_sni -i httpbin.example.com
    use-server master if httpbin_app

    server master 192.168.50.10:32009 check ssl verify none

     http-request set-header Host httpbin.example.com
     http-request set-header X-Forwarded-For %[src]
     http-request set-header X-Forwarded-Port %[dst_port]
     http-request add-header X-Forwarded-Proto https if { ssl_fc }

使用 HAProxy 我总是得到 503。同样在启动过程中,HAProxy 会说以下行:

haproxy[14260]:后端 httpbin 没有可用的服务器!

你能帮忙找出后端的正确配置吗?

标签: haproxykubernetes-ingressistio

解决方案


最后在 HAProxy 社区的帮助下,我找到了 Istio Ingress 的正确配置。这是非常基本的。请根据您的需要更新设置。下面是配置链接。

https://gist.github.com/emamulandalib/2a613f5308c29518fcbcdc6b3bad3900


推荐阅读