A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Kubernetes Carbon Intensity Exporter

Provides a data exporter by which Kubernetes operators can leverage the carbon intensity data from 3rd party for carbon-aware workload scheduling.
https://github.com/azure/kubernetes-carbon-intensity-exporter

Category: Emissions
Sub Category: Carbon Intensity and Accounting

Keywords

carbon-intensity kubernetes sustainable

Keywords from Contributors

measur transforms observation web-mapping 3d-map conversion archiving simulator optimize orchestration

Last synced: about 24 hours ago
JSON representation

Repository metadata

Kubernetes Carbon Intensity Exporter

README.md

Kubernetes Carbon Intensity Exporter

This repo provides a data exporter by which Kubernetes operators can leverage the carbon intensity data from 3rd party for carbon-aware workload scheduling.

Installation

We provide a helm chart to help install the exporter. Note that this data exporter ONLY retrieves the carbon intensity data from
WattTime OR Electricity Maps.

WattTime

You need to get the authentication ID/Password from WattTime organization before using the exporter.

export WT_USERNAME=XXXX   # WattTime auth info.
export WT_PASSWORD=YYYY
export REGION=westus     # The region where the AKS cluster locates.

helm del carbon-intensity-exporter
helm install carbon-intensity-exporter \
   --set carbonDataExporter.region=$REGION \
   --set wattTime.username=$WT_USERNAME \
   --set wattTime.password=$WT_PASSWORD \
   ./charts/carbon-intensity-exporter

Electricity Maps

You need to get an API token from Electricity Maps before using the exporter.
You can check the name of the API token HTTP header to use and the base URL in
the Electricity Maps API portal.

export EM_API_TOKEN=XXXX   # Electricity Maps API token.
export EM_API_TOKEN_HEADER=auth-token   # Electricity Maps API token HTTP header.
export EM_BASE_URL=https://api.electricitymap.org/v3/
export PROVIDER=ElectricityMaps
export REGION=westus     # The region where the AKS cluster locates.

helm del carbon-intensity-exporter
helm install carbon-intensity-exporter \
   --set carbonDataExporter.region=$REGION \
   --set providerName=$PROVIDER \
   --set electricityMaps.apiToken=$EM_API_TOKEN \
   --set electricityMaps.apiTokenHeader=$EM_API_TOKEN_HEADER \
   --set electricityMaps.baseURL=$EM_BASE_URL \
   ./charts/carbon-intensity-exporter

View carbon intensity data

You should be able to see one exporter Pod running in the kube-system namespace.

$ kubectl get pod -n kube-system | grep carbon-intensity-exporter
$ carbon-intensity-exporter-XXXXXXX-XXXXX   2/2     Running   0          3m25s

You should also see one configmap carbon-intensity is created in the kube-system namespace.

$ kubectl get configmap -n kube-system | grep carbon-intensity
$ carbon-intensity                        7      3m25s

Integration

The configmap is formatted as the following:

apiVersion: v1
kind: ConfigMap
metadata:
  name: carbonintensity
  namespace: kube-system
immutable: true
data:
  lastHeartbeatTime: # The latest time that the data exporter controller sends the data. 
  message: # Additional information for user notification, if any. 
  numOfRecords: # The number can be any value between 0 (no records for the current location) and 24 * 12. 
  forecastDateTime: # The time when the raw data was generated.
  minForecast: # min forecast in the data.
  maxForecast: # max forecast in the data.
binarydata: 
  data: # json marshal of the EmissionsData array.

The EmissionData struct is defined in here. The data exporter will retrieve the 24-hour carbon intensity forecast data
from WattTime every 12 hours. Upon successful data pull, the old configmap will be deleted and a new configmap with the same name will be created.
If the data pull hits failures, the new confgimap is still created with the last seen binary data and the failure reason should be mentioned in the value
of the message key. Any Kubernetes operator can read the configmap for utilizing the carbon intensity data.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct.
For more information see the Code of Conduct FAQ or
contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
Microsoft's Trademark & Brand Guidelines.
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 7 days ago

Total Commits: 52
Total Committers: 9
Avg Commits per committer: 5.778
Development Distribution Score (DDS): 0.635

Commits in past year: 2
Committers in past year: 2
Avg Commits per committer in past year: 1.0
Development Distribution Score (DDS) in past year: 0.5

Name Email Commits
Heba Elayoty 3****y 19
dependabot[bot] 4****] 18
Microsoft Open Source m****e 5
Fei Guo v****3@g****m 3
Ross Fairbanks r****7 2
Paul Yu p****u@m****m 2
microsoft-github-operations[bot] 5****] 1
Sertaç Özercan 8****n 1
Batuhan Apaydın d****n@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 5
Total pull requests: 63
Average time to close issues: about 2 months
Average time to close pull requests: 6 days
Total issue authors: 3
Total pull request authors: 8
Average comments per issue: 2.0
Average comments per pull request: 0.38
Merged pull request: 39
Bot issues: 0
Bot pull requests: 41

Past year issues: 2
Past year pull requests: 2
Past year average time to close issues: about 2 months
Past year average time to close pull requests: 5 days
Past year issue authors: 2
Past year pull request authors: 2
Past year average comments per issue: 1.0
Past year average comments per pull request: 0.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/azure/kubernetes-carbon-intensity-exporter

Top Issue Authors

  • tkennes (2)
  • rossf7 (2)
  • pauldotyu (1)

Top Pull Request Authors

  • dependabot[bot] (41)
  • helayoty (13)
  • pauldotyu (2)
  • Fei-Guo (2)
  • rossf7 (2)
  • sozercan (1)
  • developer-guy (1)
  • ChrisChinchilla (1)

Top Issue Labels

Top Pull Request Labels

  • dependencies (41)
  • github_actions (21)
  • go (5)
  • documentation (1)

Package metadata

proxy.golang.org: github.com/Azure/kubernetes-carbon-intensity-exporter

  • Homepage: https://github.com/Azure/kubernetes-carbon-intensity-exporter
  • Documentation: https://pkg.go.dev/github.com/Azure/kubernetes-carbon-intensity-exporter#section-documentation
  • Licenses: MIT
  • Latest release: v0.4.0 (published about 1 month ago)
  • Last Synced: 2025-04-24T14:30:23.707Z (3 days ago)
  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Docker Downloads: 59
  • Rankings:
    • Forks count: 7.697%
    • Stargazers count: 7.919%
    • Dependent packages count: 8.399%
    • Average: 8.657%
    • Dependent repos count: 10.613%
proxy.golang.org: github.com/azure/kubernetes-carbon-intensity-exporter


Dependencies

.github/workflows/codeql.yml actions
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • github/codeql-action/analyze fdcae64e1484d349b3366718cdfef3d404390e85 composite
  • github/codeql-action/autobuild fdcae64e1484d349b3366718cdfef3d404390e85 composite
  • github/codeql-action/init fdcae64e1484d349b3366718cdfef3d404390e85 composite
.github/workflows/create-images.yml actions
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • docker/build-push-action 0565240e2d4ab88bba5387d719585280857ece09 composite
  • docker/login-action 343f7c4344506bcbf9b4de18042ae17996df046d composite
  • docker/setup-buildx-action f95db51fddba0c2d1ec667646a06c2ce06100226 composite
.github/workflows/lint.yml actions
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-go v4 composite
docker/exporter/Dockerfile docker
  • gcr.io/distroless/static nonroot build
  • golang 1.19 build
docker/server/Dockerfile docker
  • mcr.microsoft.com/dotnet/aspnet 6.0 build
  • mcr.microsoft.com/dotnet/sdk 6.0 build
go.mod go
  • github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1
  • github.com/NYTimes/gziphandler v1.1.1
  • github.com/antihax/optional v1.0.0
  • github.com/antlr/antlr4/runtime/Go/antlr v1.4.10
  • github.com/beorn7/perks v1.0.1
  • github.com/blang/semver/v4 v4.0.0
  • github.com/cenkalti/backoff/v4 v4.1.3
  • github.com/cespare/xxhash/v2 v2.2.0
  • github.com/coreos/go-semver v0.3.0
  • github.com/coreos/go-systemd/v22 v22.3.2
  • github.com/davecgh/go-spew v1.1.1
  • github.com/emicklei/go-restful/v3 v3.9.0
  • github.com/evanphx/json-patch v4.12.0+incompatible
  • github.com/felixge/httpsnoop v1.0.3
  • github.com/fsnotify/fsnotify v1.6.0
  • github.com/go-logr/logr v1.2.3
  • github.com/go-logr/stdr v1.2.2
  • github.com/go-openapi/jsonpointer v0.19.5
  • github.com/go-openapi/jsonreference v0.20.0
  • github.com/go-openapi/swag v0.19.14
  • github.com/gogo/protobuf v1.3.2
  • github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
  • github.com/golang/protobuf v1.5.2
  • github.com/google/cel-go v0.12.6
  • github.com/google/gnostic v0.5.7-v3refs
  • github.com/google/go-cmp v0.5.9
  • github.com/google/gofuzz v1.1.0
  • github.com/google/uuid v1.3.0
  • github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
  • github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0
  • github.com/imdario/mergo v0.3.6
  • github.com/inconshreveable/mousetrap v1.0.1
  • github.com/josharian/intern v1.0.0
  • github.com/json-iterator/go v1.1.12
  • github.com/mailru/easyjson v0.7.6
  • github.com/matttproud/golang_protobuf_extensions v1.0.2
  • github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae
  • github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
  • github.com/modern-go/reflect2 v1.0.2
  • github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
  • github.com/pkg/errors v0.9.1
  • github.com/prometheus/client_golang v1.14.0
  • github.com/prometheus/client_model v0.3.0
  • github.com/prometheus/common v0.37.0
  • github.com/prometheus/procfs v0.8.0
  • github.com/spf13/cobra v1.6.0
  • github.com/spf13/pflag v1.0.5
  • github.com/stoewer/go-strcase v1.2.0
  • go.etcd.io/etcd/api/v3 v3.5.5
  • go.etcd.io/etcd/client/pkg/v3 v3.5.5
  • go.etcd.io/etcd/client/v3 v3.5.5
  • go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0
  • go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.0
  • go.opentelemetry.io/otel v1.10.0
  • go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0
  • go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0
  • go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0
  • go.opentelemetry.io/otel/metric v0.31.0
  • go.opentelemetry.io/otel/sdk v1.10.0
  • go.opentelemetry.io/otel/trace v1.10.0
  • go.opentelemetry.io/proto/otlp v0.19.0
  • go.uber.org/atomic v1.7.0
  • go.uber.org/multierr v1.6.0
  • go.uber.org/zap v1.19.0
  • golang.org/x/net v0.7.0
  • golang.org/x/oauth2 v0.4.0
  • golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
  • golang.org/x/sys v0.5.0
  • golang.org/x/term v0.5.0
  • golang.org/x/text v0.7.0
  • golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
  • google.golang.org/appengine v1.6.7
  • google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f
  • google.golang.org/grpc v1.53.0
  • google.golang.org/protobuf v1.28.1
  • gopkg.in/inf.v0 v0.9.1
  • gopkg.in/yaml.v2 v2.4.0
  • gopkg.in/yaml.v3 v3.0.1
  • k8s.io/api v0.26.2
  • k8s.io/apimachinery v0.26.2
  • k8s.io/apiserver v0.26.2
  • k8s.io/client-go v0.26.2
  • k8s.io/component-base v0.26.2
  • k8s.io/klog/v2 v2.80.1
  • k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280
  • k8s.io/utils v0.0.0-20221107191617-1a15be271d1d
  • sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.35
  • sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
  • sigs.k8s.io/structured-merge-diff/v4 v4.2.3
  • sigs.k8s.io/yaml v1.3.0
go.sum go
  • 651 dependencies

Score: 10.141716741268379