Kepler (Kubernetes-based Efficient Power Level Exporter) is a Prometheus exporter. It uses eBPF to probe CPU performance counters and Linux kernel tracepoints.
These data and stats from cgroup and sysfs can then be fed into ML models to estimate energy consumption by Pods.
Kind
cluster.kind create cluster --config=./01-setup-cluster/01-local-cluster-config.yml
kubectl config use-context kind-kepler-demo-local-cluster
kubectl cluster-info --context kind-kepler-demo-local-cluster
kube-prometheus-stack
.helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus prometheus-community/kube-prometheus-stack \
--namespace monitoring \
--create-namespace \
--wait
kubectl --namespace monitoring get pods -l "release=prometheus"
#NAME READY STATUS RESTARTS AGE
#prometheus-kube-prometheus-operator-8484fbd69d-g7lvl 1/1 Running 0 4m3s
#prometheus-kube-state-metrics-6f659dc9cb-xjzx2 1/1 Running 0 4m3s
#prometheus-prometheus-node-exporter-g7mg2 1/1 Running 0 4m3s
kubectl --namespace monitoring get pods
NAME READY STATUS RESTARTS AGE
alertmanager-prometheus-kube-prometheus-alertmanager-0 2/2 Running 0 14h
prometheus-grafana-6ffd599f89-wwrf5 3/3 Running 0 14h
prometheus-kube-prometheus-operator-8484fbd69d-g7lvl 1/1 Running 0 14h
prometheus-kube-state-metrics-6f659dc9cb-xjzx2 1/1 Running 0 14h
prometheus-prometheus-kube-prometheus-prometheus-0 2/2 Running 0 14h
prometheus-prometheus-node-exporter-g7mg2 1/1 Running 0 14h
Itβs easier to configure using k9s. Start the utility and type namespace
to list all namespaces and choose monitoring
.
Choose the pod with prometheus-grafana-*
and press shift-f
for port forwarding.
I have used port 3002
as the port 3000 in my machine is already occupied by different service.
admin
and password as prom-operator
.helm repo add kepler https://sustainable-computing-io.github.io/kepler-helm-chart
helm repo update
helm search repo kepler
helm install kepler kepler/kepler --namespace kepler --create-namespace --dry-run --devel
helm install kepler kepler/kepler \
--namespace kepler \
--create-namespace \
--set serviceMonitor.enabled=true \
--set serviceMonitor.labels.release=prometheus
KPLR_POD=$(
kubectl get pod \
-l app.kubernetes.io/name=kepler \
-o jsonpath="{.items[0].metadata.name}" \
-n kepler
)
kubectl wait --for=condition=Ready pod $KPLR_POD --timeout=-1s -n kepler
As there is no load and consumption, hence the load will almost equivalent to zero. Go to Dashboard
and click on new
and choose Import
. With import option, we can add predefined JSON
files from the kepler github repo. The json files also present in folder 03-grafana-dashboard.
And, then simply upload the JSON files, and access it.
With help of the dashboard you can monitor the resources, and can optimize the usage.
$ helm list --all-namespaces | awk '{print $1, $2}'
NAME NAMESPACE
kepler kepler
prometheus monitoring
$ helm uninstall kepler --namespace kepler
release "kepler" uninstalled
$ helm uninstall prometheus --namespace monitoring
release "prometheus" uninstalled
Thank you for contributing towards the green development π.