Skip to content

sustainable-computing-io/kepler-operator

Repository files navigation

kepler-operator

Kepler Operator installs Kepler and all required manifests on Kubernetes/OpenShift

Description

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.

Check out the project on GitHub ➡️ Kepler

Getting Started

You’ll need a Kubernetes/OpenShift cluster to run against. You can use KIND to get a local cluster for testing, or run against a remote cluster.

Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info shows).

To run a kind cluster locally

make cluster-up

Run kepler-operator locally out of cluster

make tools
make run
kubectl apply -k config/samples/

Run kepler-operator on vanilla Kubernetes

make tools
kubectl create -f https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.76.0/bundle.yaml
kubectl create -f https://github.com/jetstack/cert-manager/releases/download/v1.15.3/cert-manager.yaml
make deploy
kubectl apply -k config/samples/

Run using pre-published image

You can use the image from quay.io to deploy kepler-operator.

make deploy OPERATOR_IMG=quay.io/sustainable_computing_io/kepler-operator:latest
kubectl apply -k config/samples/

Alternatively, if you like to build and use your own image,

make operator-build operator-push IMG_BASE=<some-registry>
make deploy IMG=<some-registry>/kepler-operator:tag
kubectl apply -k config/samples/

Uninstall the operator

List the installed version and the related resources that will be deleted before uninstalling by running the uninstall script.

./hack/uninstall-operator.sh

Once the above is verified, uninstall the operator and all the related resources by specifying the --delete flag.

./hack/uninstall-operator.sh  --delete

Developer Docs

Developer Docs can be found under docs/developer

Automated development environment

If don't have a go development environment, or you just want a reproducible environment to start fresh, you can use Docker Desktop, Visual Studio Code, and the Dev Containers extension to bring up an environment with go, docker, kind, kubectl, kustomize, and oc.

To activate this, open the project from the command line with code . and then press the Reopen in Container button when prompted. (See the Developing inside a Container documentation for more details).

Contributing

You can contribute by:

License

Copyright 2022.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.