From 6a38a1ac3744a597b2934167bf749f6885ae3bc5 Mon Sep 17 00:00:00 2001 From: Danny Kulchinsky Date: Mon, 20 Mar 2017 18:22:06 -0400 Subject: [PATCH] Adding Prometheus metrics scrape annotations Allow Prometheus automatic discovery of nginx metrics endpoint Fixed https://github.com/kubernetes/ingress/issues/464 --- examples/daemonset/nginx/nginx-ingress-daemonset.yaml | 3 +++ examples/deployment/nginx/nginx-ingress-controller.yaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/examples/daemonset/nginx/nginx-ingress-daemonset.yaml b/examples/daemonset/nginx/nginx-ingress-daemonset.yaml index 0db798c30..f785ff4ec 100644 --- a/examples/daemonset/nginx/nginx-ingress-daemonset.yaml +++ b/examples/daemonset/nginx/nginx-ingress-daemonset.yaml @@ -10,6 +10,9 @@ spec: metadata: labels: name: nginx-ingress-lb + annotations: + prometheus.io/port: '10254' + prometheus.io/scrape: 'true' spec: terminationGracePeriodSeconds: 60 containers: diff --git a/examples/deployment/nginx/nginx-ingress-controller.yaml b/examples/deployment/nginx/nginx-ingress-controller.yaml index 9ed25ad7f..63705a6ee 100644 --- a/examples/deployment/nginx/nginx-ingress-controller.yaml +++ b/examples/deployment/nginx/nginx-ingress-controller.yaml @@ -11,6 +11,9 @@ spec: metadata: labels: k8s-app: nginx-ingress-controller + annotations: + prometheus.io/port: '10254' + prometheus.io/scrape: 'true' spec: # hostNetwork makes it possible to use ipv6 and to preserve the source IP correctly regardless of docker configuration # however, it is not a hard dependency of the nginx-ingress-controller itself and it may cause issues if port 10254 already is taken on the host