HAProxy 是一个开源代理应用程序。有关更多信息,请参阅 HAProxy
如果您在具有 Fargate 启动类型的集群上运行 HAProxy,则在执行此过程中的步骤之前,您需要设置 Fargate 配置文件。要设置配置文件,请输入以下命令。将 MyCluster
替换为您的集群的名称。
eksctl create fargateprofile --cluster
MyCluster
\ --namespace haproxy-ingress-sample --name haproxy-ingress-sample
安装带有 Metric Exporter 的 HAProxy 以测试 Container Insights Prometheus 支持
-
输入以下命令以添加 Helm incubator 存储库:
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
-
输入以下命令以创建新的命名空间:
kubectl create namespace haproxy-ingress-sample
-
输入以下命令来安装 HAProxy:
helm install haproxy haproxy-ingress/haproxy-ingress \ --namespace haproxy-ingress-sample \ --set defaultBackend.enabled=true \ --set controller.stats.enabled=true \ --set controller.metrics.enabled=true \ --set-string controller.metrics.service.annotations."prometheus\.io/port"="9101" \ --set-string controller.metrics.service.annotations."prometheus\.io/scrape"="true"
-
输入以下命令以确认服务的注释:
kubectl describe service haproxy-haproxy-ingress-metrics -n haproxy-ingress-sample
您应该看到以下注释。
Annotations: prometheus.io/port: 9101 prometheus.io/scrape: true
卸载 HAProxy
-
输入以下命令:
helm uninstall haproxy --namespace haproxy-ingress-sample kubectl delete namespace haproxy-ingress-sample