This document describes the metrics exposed by the k8s-overcommit-operator. These metrics can be used to monitor the operator's behavior, performance, and the resources it manages.
Type: Counter Description: Total number of pods requested to be mutated by the webhook.
Labels:
class: Overcommit class applied to the pod
Example:
k8s_overcommit_operator_pods_requested_total{class="high-density"} 150
k8s_overcommit_operator_pods_requested_total{class="default"} 89
Type: Counter Description: Total number of pods successfully mutated by the k8s-overcommit-operator webhook.
Labels:
class: Overcommit class that was applied
Example:
k8s_overcommit_operator_mutated_pods_total{class="high-density"} 145
k8s_overcommit_operator_mutated_pods_total{class="default"} 82
Type: Counter Description: Total number of pods that were not mutated by the operator's webhook.
Labels:
class: Overcommit class (if any)generate_name: Generated name of the podnamespace: Namespace where the pod was createdreason: Reason why the pod was not mutated
Common reasons:
no_limits: Pod has no resource limits definedexcluded_namespace: Namespace is in the exclusion listno_class_found: No matching overcommit class foundvalidation_error: Pod spec validation failed
Example:
k8s_overcommit_operator_pods_not_mutated_total{class="",generate_name="app-",namespace="kube-system",reason="excluded_namespace"} 25
k8s_overcommit_operator_pods_not_mutated_total{class="",generate_name="worker-",namespace="default",reason="no_limits"} 12
Type: Counter Description: Detailed counter for individual pod mutations with full context.
Labels:
class: Overcommit class appliedkind: Kubernetes resource kind (usually "Pod")name: Name of the podnamespace: Namespace of the pod
Example:
k8s_overcommit_operator_pod_mutated{class="high-density",kind="Pod",name="web-app-7f8b9c",namespace="production"} 1
k8s_overcommit_operator_pod_mutated{class="default",kind="Pod",name="worker-abc123",namespace="default"} 1
Type: Gauge Description: Total number of OvercommitClass resources currently defined in the cluster.
Labels: None
Example:
k8s_overcommit_operator_total_classes 5
Type: Gauge Description: Version information of the k8s-overcommit-operator.
Labels:
version: Semantic version of the operator
Example:
k8s_overcommit_operator_version{version="1.0.0"} 1
Type: Gauge Description: Information about each OvercommitClass resource.
Labels:
name: Name of the OvercommitClasscpu: CPU overcommit ratio (0.0-1.0)memory: Memory overcommit ratio (0.0-1.0)isDefault: Whether this is the default class ("true"/"false")
Example:
k8s_overcommit_operator_class{name="high-density",cpu="0.2",memory="0.8",isDefault="true"} 1
k8s_overcommit_operator_class{name="moderate",cpu="0.5",memory="0.9",isDefault="false"} 1
k8s_overcommit_operator_class{name="conservative",cpu="0.8",memory="0.95",isDefault="false"} 1
The operator exposes metrics on the /metrics endpoint, typically on port 8080:
# Direct access to metrics
curl http://<operator-pod-ip>:8080/metrics
# Through port-forward
kubectl port-forward -n k8s-overcommit-operator-system deployment/k8s-overcommit-operator-controller-manager 8080:8080
curl http://localhost:8080/metricsTo see only k8s-overcommit-operator metrics:
curl -s http://localhost:8080/metrics | grep k8s_overcommit_operatorAdd the following ServiceMonitor to scrape metrics:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: k8s-overcommit-operator-metrics
namespace: k8s-overcommit-operator-system
spec:
selector:
matchLabels:
control-plane: controller-manager
endpoints:
- port: https
scheme: https
tlsConfig:
insecureSkipVerify: true
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
path: /metricsCreate dashboards to visualize:
- Pod Mutation Rate:
rate(k8s_overcommit_operator_mutated_pods_total[5m]) - Mutation Success Rate:
rate(k8s_overcommit_operator_mutated_pods_total[5m]) / rate(k8s_overcommit_operator_pods_requested_total[5m]) - Active Classes:
k8s_overcommit_operator_total_classes
You have a example dashboard in grafana_dashboard.json
rate(k8s_overcommit_operator_mutated_pods_total[5m]) by (class)
k8s_overcommit_operator_pods_not_mutated_total by (reason)
sum(rate(k8s_overcommit_operator_mutated_pods_total[5m])) /
sum(rate(k8s_overcommit_operator_pods_requested_total[5m])) * 100
topk(10,
sum(k8s_overcommit_operator_pods_not_mutated_total{reason="excluded_namespace"}) by (namespace)
)
count(k8s_overcommit_operator_class) by (isDefault)
sum(rate(k8s_overcommit_operator_mutated_pods_total[5m])) by (class)
sum(rate(k8s_overcommit_operator_pods_not_mutated_total[5m])) by (reason)
- Metrics not appearing: Check if the operator pod is running and metrics port is accessible
- Stale metrics: Verify the operator is processing pod admission requests
- Missing labels: Ensure OvercommitClass resources have proper labels defined
# Check operator pod status
kubectl get pods -n k8s-overcommit-operator-system
# View operator logs
kubectl logs -n k8s-overcommit-operator-system deployment/k8s-overcommit-operator-controller-manager
# Test metrics endpoint
kubectl port-forward -n k8s-overcommit-operator-system svc/k8s-overcommit-operator-controller-manager-metrics-service 8080:8443
curl -k https://localhost:8080/metrics