-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable metrics via prometheus operator
Expose metrics via prometheus.monitoring.coreos.com/v1 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 | Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
- Loading branch information
1 parent
f02d172
commit 5515330
Showing
19 changed files
with
357 additions
and
24 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: "prometheus-{{ .Release.Name }}-metrics" | ||
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.fullname" . }}"]} | ||
{{- 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,62 @@ | ||
--- | ||
title: "Metrics" | ||
layout: default | ||
sort: 7 | ||
--- | ||
|
||
# Metrics | ||
|
||
Metrics are configured to be exposed using 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. | ||
|
||
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 allow [prometheus-operator][prometheus-operator] | ||
to scrape metrics from node-feature-discovery, | ||
run the following command: | ||
|
||
```bash | ||
kubectl apply -k https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref={{ site.release }} | ||
kubectl apply -k https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/prometheus?ref={{ site.release }} | ||
``` | ||
|
||
## Via Helm | ||
|
||
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. | ||
|
||
## Chart parameters | ||
|
||
In order to tailor the deployment of the Node Feature Discovery to your cluster needs | ||
We have introduced the following Chart parameters to customize the deployment. | ||
|
||
### General parameters | ||
|
||
| Name | Type | Default | description | | ||
| ---- | ---- | ------- | ----------- | | ||
| `prometheus.enable` | bool | false | Specifies whether to expose mtrics using prometheus.Operator | | ||
|
||
### Master pod parameters | ||
|
||
| Name | Type | Default | description | | ||
|-----------------------------|---------|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `master.metricsPort` | integer | 8081 | Port on which to expose metrics from components to prometheus.Operator | | ||
|
||
### Worker pod parameters | ||
|
||
| Name | Type | Default | description | | ||
| ---- | ---- | ------- | ----------- | | ||
| `worker.metricsPort*` | integer | 8081 | Port on which to expose metrics from components to prometheus.Operator | |
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.