Skip to content

Instantly share code, notes, and snippets.

@rootfs
Last active September 30, 2024 06:38
Show Gist options
  • Save rootfs/f6338b29a10808064caeeecc4ff6121a to your computer and use it in GitHub Desktop.
Save rootfs/f6338b29a10808064caeeecc4ff6121a to your computer and use it in GitHub Desktop.

create minikube

The following create a minikube with 10 CPU cores and 32GB memory. This is for experiments with heavy workload.

It uses kvm hypervisor. Make sure the qemu and libvirt have already installed

minikube start --cpus 10 --memory 32GB --disk-size=400g --extra-disks=2 --driver=kvm2 --force --container-runtime cri-o

install prometheus and grafana

git clone https://github.com/prometheus-operator/kube-prometheus
cd kube-prometheus/
kubectl apply --server-side -f manifests/setup
kubectl apply -f manifests/

install kepler

kubectl apply -f https://gist.githubusercontent.com/rootfs/be880f0607cbe63433aec6afb38e1fbb/raw/a233434ab44db7224a4abf2154fa38b49c91e357/kepler-apiserver-k8s.yaml

read kepler metrics

check if kepler metrics are there

kubectl exec -ti -n monitoring prometheus-k8s-0 -- sh -c 'wget -O- "localhost:9090/api/v1/query?query=kepler_container_core_joules_total[5s]"'

port forward prometheus metrics to local host

# ssh to your host that runs minikube
ssh -L9090:localhost:9090 your_name@your_host
# once logged in
kubectl port-forward service/prometheus-k8s -n monitoring 9090:9090
# open a browser on your local host and check prometheus metrics at localhost:9090

port forward Kepler metrics to localhost

kubectl port-forward -n kepler service/kepler-exporter 9102:9102

Then open a browser on your local host and go to http://localhost:9102/metrics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment