Skip to content

sustainable-computing-io/kepler-operator

Repository files navigation

Kepler Operator

License

Kepler Operator is a Kubernetes operator that automates the deployment and management of Kepler on Kubernetes and OpenShift clusters.

What is Kepler?

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 or OpenShift cluster. For local testing, use KIND. Otherwise, connect to a remote cluster.

Note: The operator uses the current kubeconfig context (check with kubectl cluster-info).

Using Kind Cluster

To quickly set up a local environment with Kind:

make cluster-up

Local Development

To run the operator locally outside the cluster:

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

On Vanilla Kubernetes

Deploy the operator and its dependencies:

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/

Using Pre-published Image

You can use the pre-built image from quay.io:

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

Alternatively, build and use your own image:

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

On OpenShift

Deploy the operator on OpenShift:

make tools
make operator-build operator-push \
     bundle bundle-build bundle-push \
     IMG_BASE=<your-registry> VERSION=0.0.0-dev
./tmp/bin/operator-sdk run bundle <your-registry>/kepler-operator-bundle:0.0.0-dev \
  --install-mode AllNamespaces --namespace openshift-operators --skip-tls

Uninstallation

To list the installed resources before deletion:

./hack/uninstall-operator.sh

To completely remove the operator and all related resources:

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

Developer Documentation

Developer documentation is available for those who want to contribute to the codebase or understand its internals.

Contributing

You can contribute by:

  • Reporting issues
  • Fixing issues by opening Pull Requests
  • Improving documentation
  • Sharing your success stories with Kepler

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.