Skip to content

Commit

Permalink
Add support for oss prometheus exporter (#346)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Dean-Coakley committed Aug 28, 2018
1 parent 68b13ad commit d2c4f38
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 7 deletions.
15 changes: 14 additions & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,19 @@ For NGINX Plus, you can access the live activity monitoring 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:
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.

To deploy the NGINX Ingress controller with the exporter, use the modified manifests:
* For a deployment, run:
```
$ kubectl apply -f deployment/nginx-ingress-with-prometheus.yaml
```
* For a daemonset, run:
```
$ kubectl apply -f daemon-set/nginx-ingress-with-prometheus.yaml
```

To deploy the NGINX Plus Ingress controller with the exporter, use the modified manifests:
* For a deployment, run:
```
$ kubectl apply -f deployment/nginx-plus-ingress-with-prometheus.yaml
Expand All @@ -182,3 +194,4 @@ Delete the `nginx-ingress` namespace to uninstall the Ingress controller along w
```
$ kubectl delete namespace nginx-ingress
```

2 changes: 1 addition & 1 deletion docs/nginx-ingress-controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | Supported | Supported |
| Extended Status | Supported via a third-party module | Not supported | Supported |
| Prometheus Integration | Supported | Not supported | Supported |
| Prometheus Integration | Supported | Supported | Supported |
| Dynamic reconfiguration of endpoints (no configuration reloading) | Supported with a third-party Lua module | Not supported | Supported |

Notes:
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Parameter | Description | Default
`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
`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
`rbac.create` | Configures RBAC. | true
`prometheues.create` | Deploys a Prometheus exporter container within the Ingress controller pod. Requires NGINX Plus. `controller.nginxplus` must be set to `true`. | false
`prometheues.create` | Deploys a Prometheus exporter container within the Ingress controller pod. | false
`prometheus.port` | Configures the port to scrape the metrics. | 9113
`prometheus.image.repository` | The image repository of the Prometheus exporter. | nginx/nginx-prometheus-exporter
`prometheus.image.tag` | The tag of the Prometheus exporter image. | 0.1.0
Expand Down
10 changes: 8 additions & 2 deletions helm-chart/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
labels:
app: {{ .Values.controller.name | trunc 63 }}
{{- if .Values.prometheus }}
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
{{- if .Values.prometheus.create }}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.prometheus.port }}"
Expand Down Expand Up @@ -93,7 +93,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.prometheus }}
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
{{- if .Values.prometheus.create }}
- image: "{{ .Values.prometheus.image.repository }}:{{ .Values.prometheus.image.tag }}"
imagePullPolicy: "{{ .Values.prometheus.image.pullPolicy }}"
name: nginx-prometheus-exporter
Expand All @@ -103,9 +103,15 @@ spec:
args:
- -web.listen-address
- :{{ .Values.prometheus.port }}
{{- if .Values.controller.nginxplus }}
- -nginx.plus
{{- end }}
- -nginx.scrape-uri
{{- if .Values.controller.nginxplus }}
- http:https://127.0.0.1:8080/api
{{ else }}
- http:https://127.0.0.1:8080/stub_status
{{- end }}
{{- end }}
{{- end }}
{{- end }}
10 changes: 8 additions & 2 deletions helm-chart/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
labels:
app: {{ .Values.controller.name | trunc 63 }}
{{- if .Values.prometheus }}
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
{{- if .Values.prometheus.create }}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.prometheus.port }}"
Expand Down Expand Up @@ -79,7 +79,7 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.prometheus }}
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
{{- if .Values.prometheus.create }}
- image: "{{ .Values.prometheus.image.repository }}:{{ .Values.prometheus.image.tag }}"
name: nginx-prometheus-exporter
imagePullPolicy: "{{ .Values.prometheus.image.pullPolicy }}"
Expand All @@ -89,9 +89,15 @@ spec:
args:
- -web.listen-address
- :{{ .Values.prometheus.port }}
{{- if .Values.controller.nginxplus }}
- -nginx.plus
{{- end }}
- -nginx.scrape-uri
{{- if .Values.controller.nginxplus }}
- http:https://127.0.0.1:8080/api
{{ else }}
- http:https://127.0.0.1:8080/stub_status
{{- end }}
{{- end }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@ controller:
enableLeaderElection: true
rbac:
create: true
prometheus:
create: false
port: 9113
image:
repository: nginx/nginx-prometheus-exporter
tag: "0.1.0"
pullPolicy: IfNotPresent
55 changes: 55 additions & 0 deletions install/daemon-set/nginx-ingress-with-prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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: "9113"
spec:
serviceAccountName: nginx-ingress
containers:
- image: nginx/nginx-ingress:1.3.0
name: nginx-ingress
ports:
- name: http
containerPort: 80
hostPort: 80
- name: https
containerPort: 443
hostPort: 443
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
args:
- -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
- -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret
#- -v=3 # Enables extensive logging. Useful for trooublshooting.
#- -report-ingress-status
#- -external-service=nginx-ingress
#- -enable-leader-election
- image: nginx/nginx-prometheus-exporter:0.1.0
name: nginx-prometheus-exporter
ports:
- name: prometheus
containerPort: 9113
args:
- -web.listen-address
- :9113
- -nginx.scrape-uri
- http:https://127.0.0.1:8080/stub_status

54 changes: 54 additions & 0 deletions install/deployment/nginx-ingress-with-prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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: "9113"
spec:
serviceAccountName: nginx-ingress
containers:
- image: nginx/nginx-ingress:1.3.0
name: nginx-ingress
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
args:
- -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
- -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret
#- -v=3 # Enables extensive logging. Useful for trooublshooting.
#- -report-ingress-status
#- -external-service=nginx-ingress
#- -enable-leader-election
- image: nginx/nginx-prometheus-exporter:0.1.0
name: nginx-prometheus-exporter
ports:
- name: prometheus
containerPort: 9113
args:
- -web.listen-address
- :9113
- nginx.scrape-uri
- http:https://127.0.0.1:8080/stub_status

0 comments on commit d2c4f38

Please sign in to comment.