Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] add support for creating ServiceMonitor in Helm chart #268

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions helm/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ .Release.Name }}
namespace: {{ default .Release.Namespace .Values.serviceMonitor.namespace }}
labels:
app.kubernetes.io/managed-by: Helm
{{- include "chart.engineLabels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "chart.engineLabels" . | nindent 6 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: "service-port"
path: {{ .Values.serviceMonitor.path }}
interval: {{ .Values.serviceMonitor.interval }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{- toYaml .Values.serviceMonitor.relabelings | nindent 8 }}
{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions helm/values.schema.json
Original file line number Diff line number Diff line change
@@ -400,6 +400,30 @@
}
}
}
},
"serviceMonitor": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"namespace": {
"type": "string"
},
"path": {
"type": "string"
},
"interval": {
"type": "string"
},
"relabelings": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
}
20 changes: 20 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -268,3 +268,23 @@ routerSpec:
# httpGet:
# # -- Path to access on the HTTP server
#

# -- ServiceMonitor configuration for Prometheus Operator
serviceMonitor:
# -- Enable ServiceMonitor
enabled: false
# -- Namespace where ServiceMonitor resource should be created
namespace: ""
# -- Path to scrape metrics from
path: "/metrics"
# -- Interval at which metrics should be scraped
interval: "10s"
# -- RelabelConfigs to apply to samples before scraping
# -- More info: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#monitoring.coreos.com/v1.RelabelConfig
relabelings: []
# - sourceLabels: [__meta_kubernetes_pod_node_name]
# separator: ;
# regex: ^(.*)$
# targetLabel: nodename
# replacement: $1
# action: replace
12 changes: 12 additions & 0 deletions observability/README.md
Original file line number Diff line number Diff line change
@@ -42,6 +42,18 @@ Open the webpage at `http://<IP of your node>:3000` to access the Grafana web pa

Import the dashboard using the `vllm-dashboard.json` in this folder.

## Enable metrics collection with ServiceMonitor

The helm chart includes built-in support for metrics collection using the ServiceMonitor resource for Prometheus. To enable this feature, set `serviceMonitor.enabled` to `true` in your `values.yaml` file:

```yaml
serviceMonitor:
enabled: true

```

This will automatically create a ServiceMonitor resource that configures Prometheus to scrape metrics from your vLLM deployments. The ServiceMonitor is discovered by the Prometheus Operator deployed by kube-prometheus-stack.

## Use Prometheus Adapter to export vLLM metrics

The vLLM router can export metrics to Prometheus using the [Prometheus Adapter](https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-adapter).
14 changes: 0 additions & 14 deletions observability/kube-prom-stack.yaml
Original file line number Diff line number Diff line change
@@ -90,17 +90,3 @@ prometheusOperator:
##
prometheus:
enabled: true

# Monitor vLLM pods using ServiceMonitor
additionalServiceMonitors:
- name: "vllm-monitor"
selector:
matchLabels:
app.kubernetes.io/managed-by: Helm
environment: test
release: test
namespaceSelector:
matchNames:
- default
endpoints:
- port: "service-port"