(Optional) Set Up HAProxy with a Metric Exporter - Amazon CloudWatch

(Optional) Set Up HAProxy with a Metric Exporter

HAProxy is an open-source proxy application. For more information, see HAProxy.

To install HAProxy with a metric exporter to test Container Insights Prometheus support

  1. Enter the following command to add the Helm incubator repo:

    helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
  2. Enter the following command to create a new namespace:

    kubectl create namespace haproxy-ingress-sample
  3. Enter the following commands to install HAProxy:

    helm install haproxy incubator/haproxy-ingress \ --namespace haproxy-ingress-sample \ --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"
  4. Enter the following command to confirm the annotation of the service:

    kubectl describe service haproxy-haproxy-ingress-controller-metrics -n haproxy-ingress-sample

    You should see the following annotations.

    Annotations: prometheus.io/port: 9101 prometheus.io/scrape: true

To uninstall HAProxy

  • Enter the following commands:

    helm uninstall haproxy --namespace haproxy-ingress-sample kubectl delete namespace haproxy-ingress-sample