Skip to content

Add prometheus servicemonitor support for NGINX Ingress controller #4210

@jasonwilliams14

Description

@jasonwilliams14

This enhancement is to support prometheus servicemonitor for NGINX Ingress controller helm deployments.

prometheus-operator Github

References:

#889
#3129

Being able to leverage the servicemonitor CRD that prometheus provides, allows users to have more flexibility and control when collecting metrics for NGINX Ingress controller.

This request will add support for both helm and manifest deployments, allowing customer to enable (helm) or apply (manifest) the additional services and servicemonitor that are required.

When using helm, if the user opts to enable servicemonitor the deployment will generate the appropriate service and servicemonitor required.
Example manifests (thanks @hostalp)

Additional service required:

apiVersion: v1
kind: Service
metadata:
  name: nginx-ingress-nginx-ingress-servicemonitor
  labels:
    app: nginx-ingress-nginx-ingress-servicemonitor
spec:
  ports:
  - name: prometheus
    protocol: TCP
    port: 9113
    targetPort: 9113
  selector:
    app: nginx-ingress-nginx-ingress

Servicemonitor definition:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: nginx-ingress-nginx-ingress-servicemonitor
  labels:
    app: nginx-ingress-nginx-ingress-servicemonitor
    release: kube-prometheus-stack
spec:
  selector:
    matchLabels:
      app: nginx-ingress-nginx-ingress-servicemonitor
  endpoints:
  - port: prometheus

The user will have to have ensure they have prometheus installed and running correctly in there cluster in order for servicemonitor to work correctly.

### Tasks
- [ ] https://github.com/nginxinc/kubernetes-ingress/issues/4329
- [ ] https://github.com/nginxinc/kubernetes-ingress/issues/4328
- [ ] https://github.com/nginxinc/kubernetes-ingress/issues/4330

Metadata

Metadata

Assignees

Labels

backlogPull requests/issues that are backlog itemsenhancementPull requests for new features/feature enhancementsproposalAn issue that proposes a feature request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions