sustainable-computing-io / susql-operator

a Kubernetes operator that aggregates energy and CO2 emission data for tagged resources
http://susql.org
Apache License 2.0
9 stars 1 forks source link
carbon-aware carbon-dioxide-emissions co2 energy green-computing kepler kubernetes monitoring openshift operator susql sustainability

SusQL Operator

SusQL is a Kubernetes operator that aggregates energy and estimated carbon dioxide emission data for pods tagged with SusQL specific labels. The energy measurements are obtained from Kepler which should be deployed on the cluster before using SusQL. Click the picture below to watch the demo video.

SusQL Demo

Getting Started

SusQL is an operator that can be deployed in a Kubernetes/OpenShift cluster. You can also use kind or minikube as a local cluster for testing, or run against a remote cluster.

Carbon Dioxide Emission Calculation

By default SusQL calculates carbon dioxide emission in grams of CO2 using a carbon intensity value from US EPA. SusQL can be configured to use other static carbon intensity values or query carbon intensity values for a given location from web API's such as those provided by the Green Software Foundation's Carbon Aware SDK.

Detailed information on configuration of CO2 emission calculation in SusQL is available in the SusQL carbon calculation documentation.

Prerequisites

Kepler is assumed to be installed in the cluster.

Installation

Using SusQL

To begin using SusQL, a LabelGroup is used to specify the set of labels that the controller uses to identify pods that belong to the same energy aggregation. An example of a LabelGroup could be:

apiVersion: susql.ibm.com/v1
kind: LabelGroup
metadata:
    name: labelgroup-name
    namespace: default
spec:
    labels:
        - my-label-1
        - my-label-2

A pod that would be part of the group of pods belonging to the same energy aggregation would specify the LabelGroup labels as:

apiVersion: v1
kind: Pod
metadata:
    name: pod-name
    labels:
        susql.label/1: my-label-1
        susql.label/2: my-label-2
spec:
    containers:
        - name: container
          image: ubuntu
          command: ["sleep"]
          args: ["infinity"]

Energy of the group of pods is exposed in two ways:

Other Examples

License

Copyright 2023, 2024.

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.