text
stringlengths
0
59.1k
value: 100
periodSeconds: 15
selectPolicy: Max
scaleDown:
# The stabilizationWindowSeconds is set to 30 to prevent the HPA from
# scaling down too aggressively. This means the controller will wait for
# 30 seconds after a scale-down event before considering another one.
# This helps to smooth out the scaling behavior and prevent "flapping"
# (rapidly scaling up and down). A larger value will make the scaling
# more conservative, which can be useful for workloads with fluctuating
# metrics, but it may also result in higher costs if the resources are
# not released quickly after a load decrease.
stabilizationWindowSeconds: 30
policies:
- type: Percent
value: 100
periodSeconds: 15
selectPolicy: Max
<|endoftext|>
# source: k8s_examples/AI/vllm-deployment/hpa/gpu-dcgm-exporter-service-generic.yaml type: yaml
# This Service provides a stable network endpoint for the NVIDIA DCGM Exporter
# pods for users who have MANUALLY installed the exporter (e.g., on EKS/AKS).
# The Prometheus Operator's ServiceMonitor will target this Service
# to discover and scrape the GPU metrics.
apiVersion: v1
kind: Service
metadata:
name: gpu-dcgm-exporter-service
# The Helm chart for the DCGM exporter is instructed to deploy it in the 'monitoring' namespace.
namespace: monitoring
labels:
# This label is critical. The generic ServiceMonitor uses this label to find
# this specific Service.
app.kubernetes.io/name: gpu-dcgm-exporter
spec:
type: ClusterIP
selector:
# This selector tells the Service which pods to route traffic to.
# It must match the labels on the DCGM exporter pods deployed by the Helm chart.
app.kubernetes.io/name: gpu-dcgm-exporter
ports:
- name: metrics
port: 9400
protocol: TCP
targetPort: 9400
<|endoftext|>
# source: k8s_examples/AI/vllm-deployment/hpa/prometheus-rule.yaml type: yaml
# This PrometheusRule defines a recording rule that is essential for making
# the raw DCGM GPU metrics usable by the HPA. The raw 'DCGM_FI_DEV_GPU_UTIL'
# metric scraped by Prometheus does not have the standard 'pod' and 'namespace'
# labels that the Prometheus Adapter needs to associate the metric with a
# specific workload pod.
#
# This rule creates a NEW metric, 'dcgm_fi_dev_gpu_util_relabelled',
# and uses the 'label_replace' function to copy the pod and namespace
# information from the 'exported_pod' and 'exported_namespace' labels into
# the standard 'pod' and 'namespace' labels. The Prometheus Adapter will then
# use this new, correctly-labelled metric.
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: dcgm-relabel-rules
namespace: monitoring
labels:
# This label ensures the Prometheus instance discovers this rule.
release: prometheus
spec:
groups:
- name: dcgm.rules
rules:
# 'record' specifies the name of the new metric to be created.
- record: dcgm_fi_dev_gpu_util_relabelled
# 'expr' contains the PromQL expression that generates the new metric.
expr: |
label_replace(
label_replace(
DCGM_FI_DEV_GPU_UTIL,
"pod",
"$1",
"exported_pod",
"(.+)"
),
"namespace",
"$1",
"exported_namespace",
"(.+)"
)
<|endoftext|>
# source: k8s_examples/AI/vllm-deployment/hpa/prometheus-adapter.yaml type: yaml
# This manifest deploys the Prometheus Adapter, which is responsible for
# reading metrics from Prometheus and exposing them to the Kubernetes
# Custom Metrics API. The Horizontal Pod Autoscaler (HPA) uses this API
# to query for the custom metrics that drive its scaling decisions.
# This file also includes the necessary RBAC permissions and the critical
# ConfigMap that defines the metric transformation rules.