Skip to content

Commit

Permalink
docs/metrics: fix prometheus config
Browse files Browse the repository at this point in the history
Metrics doc depends on the controller pod selector to allow Prometheus
find the controller. Controller labels was changed when upgrading to
Helm deployment. This update changes also the label used in the
Prometheus config.
  • Loading branch information
jcmoraisjr committed Jan 18, 2021
1 parent 76aff6b commit 32b7022
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion docs/content/en/docs/examples/metrics.md
Expand Up @@ -31,7 +31,7 @@ The following patch adds ports `9105` and `10254` to the HAProxy Ingress contain
Note: this patch will restart the controller!

```
kubectl --namespace ingress-controller patch daemonset haproxy-ingress -p '{"spec":{"template":{"spec":{"containers":[{"name":"haproxy-ingress","ports":[{"name":"exporter","containerPort":9105},{"name":"ingress-stats","containerPort":10254}]}]}}}}'
kubectl --namespace ingress-controller patch deployment haproxy-ingress -p '{"spec":{"template":{"spec":{"containers":[{"name":"haproxy-ingress","ports":[{"name":"exporter","containerPort":9105},{"name":"ingress-stats","containerPort":10254}]}]}}}}'
```

## Deploy Prometheus
Expand All @@ -46,6 +46,19 @@ kubectl create -f https://haproxy-ingress.github.io/docs/examples/metrics/promet
This deployment has no persistent volume, so all the collected metrics will be lost if the pod is recreated.
{{% /alert %}}

{{% alert title="Warning" color="warning" %}}
If HAProxy Ingress wasn't deployed with Helm, change the following line in the `configmap/prometheus-cfg` resource, jobs `haproxy-ingress` and `haproxy-exporter`:

```diff
relabel_configs:
- - source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance]
+ - source_labels: [__meta_kubernetes_pod_label_run]
regex: haproxy-ingress
```

This will ensure that Prometheus finds the controller pods.
{{% /alert %}}

Check if Prometheus is up and running:

```
Expand Down
4 changes: 2 additions & 2 deletions docs/content/en/docs/examples/metrics/prometheus.yaml
Expand Up @@ -49,7 +49,7 @@ data:
names:
- ingress-controller
relabel_configs:
- source_labels: [__meta_kubernetes_pod_label_run]
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance]
regex: haproxy-ingress
action: keep
- source_labels: [__meta_kubernetes_pod_container_port_number]
Expand All @@ -66,7 +66,7 @@ data:
params:
scope: [global,frontend,backend]
relabel_configs:
- source_labels: [__meta_kubernetes_pod_label_run]
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_instance]
regex: haproxy-ingress
action: keep
- source_labels: [__meta_kubernetes_pod_container_port_number]
Expand Down

0 comments on commit 32b7022

Please sign in to comment.