Skip to content

Commit d2c4f38

Browse files
authored
Add support for oss prometheus exporter (#346)
* Added OSS Prometheus deployment manifest * Added OSS Prometheus daemonset manifest * Updated comparison document * Updated install document * Helm: Add OSS Prometheus exporter support * Changed prometheus.create note to reflect that nginxplus is no longer required
1 parent 68b13ad commit d2c4f38

File tree

8 files changed

+148
-7
lines changed

8 files changed

+148
-7
lines changed

docs/installation.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,19 @@ For NGINX Plus, you can access the live activity monitoring dashboard:
166166
167167
## Support For Prometheus Monitoring
168168
169-
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:
169+
If you are using [Prometheus](https://prometheus.io/), you can deploy the NGINX Ingress controller with the [Prometheus exporter](https://github.com/nginxinc/nginx-prometheus-exporter) for NGINX. The exporter will export NGINX metrics into your Prometheus.
170+
171+
To deploy the NGINX Ingress controller with the exporter, use the modified manifests:
172+
* For a deployment, run:
173+
```
174+
$ kubectl apply -f deployment/nginx-ingress-with-prometheus.yaml
175+
```
176+
* For a daemonset, run:
177+
```
178+
$ kubectl apply -f daemon-set/nginx-ingress-with-prometheus.yaml
179+
```
180+
181+
To deploy the NGINX Plus Ingress controller with the exporter, use the modified manifests:
170182
* For a deployment, run:
171183
```
172184
$ kubectl apply -f deployment/nginx-plus-ingress-with-prometheus.yaml
@@ -182,3 +194,4 @@ Delete the `nginx-ingress` namespace to uninstall the Ingress controller along w
182194
```
183195
$ kubectl delete namespace nginx-ingress
184196
```
197+

docs/nginx-ingress-controllers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The table below summarizes the key difference between nginxinc/kubernetes-ingres
3333
| **Operational** |
3434
| Reporting the IP address(es) of the Ingress controller into Ingress resources | Supported | Supported | Supported |
3535
| Extended Status | Supported via a third-party module | Not supported | Supported |
36-
| Prometheus Integration | Supported | Not supported | Supported |
36+
| Prometheus Integration | Supported | Supported | Supported |
3737
| Dynamic reconfiguration of endpoints (no configuration reloading) | Supported with a third-party Lua module | Not supported | Supported |
3838

3939
Notes:

helm-chart/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Parameter | Description | Default
8989
`controller.reportIngressStatus.externalService` | Specifies the name of the service with the type LoadBalancer through which the Ingress controller is exposed externally. The external address of the service is used when reporting the status of Ingress resources. `controller.reportIngressStatus.enable` must be set to `true`. | nginx-ingress
9090
`controller.reportIngressStatus.enableLeaderElection` | Enable Leader election to avoid multiple replicas of the controller reporting the status of Ingress resources. `controller.reportIngressStatus.enable` must be set to `true`. | true
9191
`rbac.create` | Configures RBAC. | true
92-
`prometheues.create` | Deploys a Prometheus exporter container within the Ingress controller pod. Requires NGINX Plus. `controller.nginxplus` must be set to `true`. | false
92+
`prometheues.create` | Deploys a Prometheus exporter container within the Ingress controller pod. | false
9393
`prometheus.port` | Configures the port to scrape the metrics. | 9113
9494
`prometheus.image.repository` | The image repository of the Prometheus exporter. | nginx/nginx-prometheus-exporter
9595
`prometheus.image.tag` | The tag of the Prometheus exporter image. | 0.1.0

helm-chart/templates/controller-daemonset.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
labels:
1818
app: {{ .Values.controller.name | trunc 63 }}
1919
{{- if .Values.prometheus }}
20-
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
20+
{{- if .Values.prometheus.create }}
2121
annotations:
2222
prometheus.io/scrape: "true"
2323
prometheus.io/port: "{{ .Values.prometheus.port }}"
@@ -93,7 +93,7 @@ spec:
9393
{{- end }}
9494
{{- end }}
9595
{{- if .Values.prometheus }}
96-
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
96+
{{- if .Values.prometheus.create }}
9797
- image: "{{ .Values.prometheus.image.repository }}:{{ .Values.prometheus.image.tag }}"
9898
imagePullPolicy: "{{ .Values.prometheus.image.pullPolicy }}"
9999
name: nginx-prometheus-exporter
@@ -103,9 +103,15 @@ spec:
103103
args:
104104
- -web.listen-address
105105
- :{{ .Values.prometheus.port }}
106+
{{- if .Values.controller.nginxplus }}
106107
- -nginx.plus
108+
{{- end }}
107109
- -nginx.scrape-uri
110+
{{- if .Values.controller.nginxplus }}
108111
- http://127.0.0.1:8080/api
112+
{{ else }}
113+
- http://127.0.0.1:8080/stub_status
114+
{{- end }}
109115
{{- end }}
110116
{{- end }}
111117
{{- end }}

helm-chart/templates/controller-deployment.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
labels:
1919
app: {{ .Values.controller.name | trunc 63 }}
2020
{{- if .Values.prometheus }}
21-
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
21+
{{- if .Values.prometheus.create }}
2222
annotations:
2323
prometheus.io/scrape: "true"
2424
prometheus.io/port: "{{ .Values.prometheus.port }}"
@@ -79,7 +79,7 @@ spec:
7979
{{- end }}
8080
{{- end }}
8181
{{- if .Values.prometheus }}
82-
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
82+
{{- if .Values.prometheus.create }}
8383
- image: "{{ .Values.prometheus.image.repository }}:{{ .Values.prometheus.image.tag }}"
8484
name: nginx-prometheus-exporter
8585
imagePullPolicy: "{{ .Values.prometheus.image.pullPolicy }}"
@@ -89,9 +89,15 @@ spec:
8989
args:
9090
- -web.listen-address
9191
- :{{ .Values.prometheus.port }}
92+
{{- if .Values.controller.nginxplus }}
9293
- -nginx.plus
94+
{{- end }}
9395
- -nginx.scrape-uri
96+
{{- if .Values.controller.nginxplus }}
9497
- http://127.0.0.1:8080/api
98+
{{ else }}
99+
- http://127.0.0.1:8080/stub_status
100+
{{- end }}
95101
{{- end }}
96102
{{- end }}
97103
{{- end }}

helm-chart/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@ controller:
3434
enableLeaderElection: true
3535
rbac:
3636
create: true
37+
prometheus:
38+
create: false
39+
port: 9113
40+
image:
41+
repository: nginx/nginx-prometheus-exporter
42+
tag: "0.1.0"
43+
pullPolicy: IfNotPresent
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: extensions/v1beta1
2+
kind: DaemonSet
3+
metadata:
4+
name: nginx-ingress
5+
namespace: nginx-ingress
6+
spec:
7+
selector:
8+
matchLabels:
9+
app: nginx-ingress
10+
template:
11+
metadata:
12+
labels:
13+
app: nginx-ingress
14+
annotations:
15+
prometheus.io/scrape: "true"
16+
prometheus.io/port: "9113"
17+
spec:
18+
serviceAccountName: nginx-ingress
19+
containers:
20+
- image: nginx/nginx-ingress:1.3.0
21+
name: nginx-ingress
22+
ports:
23+
- name: http
24+
containerPort: 80
25+
hostPort: 80
26+
- name: https
27+
containerPort: 443
28+
hostPort: 443
29+
env:
30+
- name: POD_NAMESPACE
31+
valueFrom:
32+
fieldRef:
33+
fieldPath: metadata.namespace
34+
- name: POD_NAME
35+
valueFrom:
36+
fieldRef:
37+
fieldPath: metadata.name
38+
args:
39+
- -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
40+
- -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret
41+
#- -v=3 # Enables extensive logging. Useful for trooublshooting.
42+
#- -report-ingress-status
43+
#- -external-service=nginx-ingress
44+
#- -enable-leader-election
45+
- image: nginx/nginx-prometheus-exporter:0.1.0
46+
name: nginx-prometheus-exporter
47+
ports:
48+
- name: prometheus
49+
containerPort: 9113
50+
args:
51+
- -web.listen-address
52+
- :9113
53+
- -nginx.scrape-uri
54+
- http://127.0.0.1:8080/stub_status
55+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: nginx-ingress
5+
namespace: nginx-ingress
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: nginx-ingress
11+
template:
12+
metadata:
13+
labels:
14+
app: nginx-ingress
15+
annotations:
16+
prometheus.io/scrape: "true"
17+
prometheus.io/port: "9113"
18+
spec:
19+
serviceAccountName: nginx-ingress
20+
containers:
21+
- image: nginx/nginx-ingress:1.3.0
22+
name: nginx-ingress
23+
ports:
24+
- name: http
25+
containerPort: 80
26+
- name: https
27+
containerPort: 443
28+
env:
29+
- name: POD_NAMESPACE
30+
valueFrom:
31+
fieldRef:
32+
fieldPath: metadata.namespace
33+
- name: POD_NAME
34+
valueFrom:
35+
fieldRef:
36+
fieldPath: metadata.name
37+
args:
38+
- -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
39+
- -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret
40+
#- -v=3 # Enables extensive logging. Useful for trooublshooting.
41+
#- -report-ingress-status
42+
#- -external-service=nginx-ingress
43+
#- -enable-leader-election
44+
- image: nginx/nginx-prometheus-exporter:0.1.0
45+
name: nginx-prometheus-exporter
46+
ports:
47+
- name: prometheus
48+
containerPort: 9113
49+
args:
50+
- -web.listen-address
51+
- :9113
52+
- nginx.scrape-uri
53+
- http://127.0.0.1:8080/stub_status
54+

0 commit comments

Comments
 (0)