From f272e301e0ecb9050dbde63ed1a14bbe9c18640e Mon Sep 17 00:00:00 2001 From: Michael Pleshakov Date: Wed, 28 Feb 2018 09:23:58 +0000 Subject: [PATCH] Add support for prometheus for Plus (#249) --- docs/installation.md | 14 ++++++ docs/nginx-ingress-controllers.md | 2 +- .../nginx-plus-ingress-with-prometheus.yaml | 46 +++++++++++++++++++ .../nginx-plus-ingress-with-prometheus.yaml | 45 ++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 install/daemon-set/nginx-plus-ingress-with-prometheus.yaml create mode 100644 install/deployment/nginx-plus-ingress-with-prometheus.yaml diff --git a/docs/installation.md b/docs/installation.md index 0ade7735b1..21b8396b63 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -149,6 +149,20 @@ For NGINX Plus, you can access the live activity monitoring dashboard: ``` 1. Open your browser at http://127.0.0.1:8080/dashboard.html to access the dashboard. +## Support For Prometheus Monitoring + +If you are using [Prometheus](https://prometheus.io/), you can deploy the NGINX Plus Ingress controller with the prometheus exporter for NGINX Plus. The exporter will export NGINX Plus metrics into your Prometheus. To deploy the Ingress controller with the exporter, use the modified manifests: +* For a deployment, run: + ``` + $ kubectl apply -f deployment/nginx-plus-ingress-with-prometheus.yaml + ``` +* For a daemon set, run: + ``` + $ kubectl apply -f daemon-set/nginx-plus-ingress-with-prometheus.yaml + ``` + +**Note**: this is a preview version of the prometheus exporter for NGINX Plus. It is not suitable for using in production environments. + ## Uninstall the Ingress Controller Delete the `nginx-ingress` namespace to uninstall the Ingress controller along with all the auxiliary resources that were created: diff --git a/docs/nginx-ingress-controllers.md b/docs/nginx-ingress-controllers.md index 1567734c0f..84b48a5e80 100644 --- a/docs/nginx-ingress-controllers.md +++ b/docs/nginx-ingress-controllers.md @@ -33,7 +33,7 @@ The table below summarizes the key difference between nginxinc/kubernetes-ingres | **Operational** | | Reporting the IP address(es) of the Ingress controller into Ingress resources | Supported | Coming soon | Coming soon | | Extended Status | Supported via a third-party module | Not supported | Supported | -| Prometheus Integration | Supported | Not supported | Coming soon | +| Prometheus Integration | Supported | Not supported | Supported | | Dynamic reconfiguration of endpoints (no configuration reloading) | Not supported | Not supported | Supported | Notes: diff --git a/install/daemon-set/nginx-plus-ingress-with-prometheus.yaml b/install/daemon-set/nginx-plus-ingress-with-prometheus.yaml new file mode 100644 index 0000000000..052a194e65 --- /dev/null +++ b/install/daemon-set/nginx-plus-ingress-with-prometheus.yaml @@ -0,0 +1,46 @@ +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: nginx-ingress + namespace: nginx-ingress +spec: + selector: + matchLabels: + app: nginx-ingress + template: + metadata: + labels: + app: nginx-ingress + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "8090" + spec: + serviceAccountName: nginx-ingress + containers: + - image: nginx-plus-ingress:1.1.1 + name: nginx-plus-ingress + ports: + - name: http + containerPort: 80 + hostPort: 80 + - name: https + containerPort: 443 + hostPort: 443 + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + args: + - -nginx-plus + - -nginx-configmaps=$(POD_NAMESPACE)/nginx-config + - -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret + #- -v=3 # Enables extensive logging. Useful for trooublshooting. + - image: nginxdemos/nginxplus-prometheus-exporter:0.1.0 + name: nginxplus-prometheus-exporter + args: + - -listen-address + - :8090 + - -plus + - -metric-endpoint + - http://127.0.0.1:8080/api diff --git a/install/deployment/nginx-plus-ingress-with-prometheus.yaml b/install/deployment/nginx-plus-ingress-with-prometheus.yaml new file mode 100644 index 0000000000..ce3428a1e3 --- /dev/null +++ b/install/deployment/nginx-plus-ingress-with-prometheus.yaml @@ -0,0 +1,45 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: nginx-ingress + namespace: nginx-ingress +spec: + replicas: 1 + selector: + matchLabels: + app: nginx-ingress + template: + metadata: + labels: + app: nginx-ingress + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "8090" + spec: + serviceAccountName: nginx-ingress + containers: + - image: nginx-plus-ingress:1.1.1 + name: nginx-plus-ingress + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + args: + - -nginx-plus + - -nginx-configmaps=$(POD_NAMESPACE)/nginx-config + - -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret + #- -v=3 # Enables extensive logging. Useful for trooublshooting. + - image: nginxdemos/nginxplus-prometheus-exporter:0.1.0 + name: nginxplus-prometheus-exporter + args: + - -listen-address + - :8090 + - -plus + - -metric-endpoint + - http://127.0.0.1:8080/api