-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1242 from ArangoGutierrez/metrics
Enable metrics via prometheus operator
- Loading branch information
Showing
19 changed files
with
344 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,5 +35,7 @@ spec: | |
command: | ||
- "nfd-master" | ||
ports: | ||
- name: metrics | ||
containerPort: 8081 | ||
- name: grpc | ||
containerPort: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,6 @@ spec: | |
- "nfd-worker" | ||
args: | ||
- "-server=nfd-master:8080" | ||
ports: | ||
- name: metrics | ||
containerPort: 8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
deployment/helm/node-feature-discovery/templates/prometheus.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{- if .Values.prometheus.enable }} | ||
# Prometheus Monitor Service (Metrics) | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PodMonitor | ||
metadata: | ||
name: {{ include "node-feature-discovery.fullname" . }} | ||
labels: | ||
{{- include "node-feature-discovery.selectorLabels" . | nindent 4 }} | ||
spec: | ||
podMetricsEndpoints: | ||
- honorLabels: true | ||
interval: 10s | ||
path: /metrics | ||
port: metrics | ||
scheme: http | ||
namespaceSelector: | ||
matchNames: | ||
- {{ include "node-feature-discovery.namespace" . }} | ||
selector: | ||
matchExpressions: | ||
- {key: app.kubernetes.io/instance, operator: In, values: ["{{ .Release.Name }}"]} | ||
- {key: app.kubernetes.io/name, operator: In, values: ["{{ include "node-feature-discovery.name" . }}"]} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: node-feature-discovery | ||
|
||
resources: | ||
- monitor.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Prometheus Monitor Service (Metrics) | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PodMonitor | ||
metadata: | ||
name: nfd-metrics | ||
labels: | ||
app: nfd | ||
spec: | ||
podMetricsEndpoints: | ||
- honorLabels: true | ||
interval: 10s | ||
path: /metrics | ||
port: metrics | ||
scheme: http | ||
namespaceSelector: | ||
matchNames: | ||
- node-feature-discovery | ||
selector: | ||
matchExpressions: | ||
- {key: app, operator: In, values: ["nfd-master", "nfd-worker"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: "Metrics" | ||
layout: default | ||
sort: 7 | ||
--- | ||
|
||
# Metrics | ||
|
||
Metrics are configured to be exposed using [prometheus operator](https://github.com/prometheus-operator/prometheus-operator) | ||
API's by default. If you want to expose metrics using the prometheus operator | ||
API's you need to install the prometheus operator in your cluster. | ||
By default NFD Master and Worker expose metrics on port 8081. | ||
|
||
The exposed metrics are | ||
|
||
| Metric | Type | Meaning | | ||
| ---------------------------------- | ------- | ---------------- | | ||
| `nfd_master_build_info` | Gauge | Version from which nfd-master was built. | | ||
| `nfd_worker_build_info` | Gauge | Version from which nfd-worker was built. | | ||
| `nfd_updated_nodes` | Counter | Time taken to label a node | | ||
| `nfd_crd_processing_time` | Gauge | Time taken to process a NodeFeatureRule CRD | | ||
| `nfd_feature_discovery_duration_seconds` | HistogramVec | Time taken to discover features on a node | | ||
|
||
## Via Kustomize | ||
|
||
To deploy NFD with metrics enabled using kustomize, you can use the | ||
[Metrics Overlay](kustomize.md#metrics). | ||
|
||
## Via Helm | ||
|
||
By default metrics are enabled when deploying NFD via Helm. To enable Prometheus | ||
to scrape metrics from NFD, you need to pass the following values to Helm: | ||
|
||
```bash | ||
--set prometheus.enable=true | ||
``` | ||
|
||
For more info on Helm deployment, see [Helm](helm.md). | ||
|
||
We recommend setting | ||
`--set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false` | ||
when deploying prometheus-operator via Helm to enable the prometheus-operator | ||
to scrape metrics from any PodMonitor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.