Skip to main content

One post tagged with "introduction"

View All Tags

· 3 min read
Davide Bianchi

Welcome to kube-green blog!

In this blog, we'll introduce the new features of kube-green, and give you some other information about kube-green.

In this first tutorial, I will try to explain how it was born and why it is useful for reducing waste of resources.

Environmental impact

Everything we do online has an impact on the real world environment.
From the emails in our inboxes to photos and videos on the cloud, from online games to digital currency, all this digital activity run on physical servers that constantly use energy.

Just some examples:

  • minecraft all time emissions are about 600 million Kg of CO2, equivalent to drive at about 2,1 billion of km (reference)
  • bitcoin produces between 22 and 22.9 million metric tons of carbon dioxide emissions a year, or between the levels produced by Jordan and Sri Lanka (reference)
  • here it is possible to see how much emissions our emails generate

The Kubernetes clusters are not an exception. Also if they run in a cloud provider far from us they produces CO2, also if not used.

The idea of kube-green

In a cluster, non production namespaces are usually used only during business hours.
The business hours are around 40 hours per week, respect the total number of weekly hours which are 168.
Also, in Kubernetes the resources could be allocated (both CPU and memory, setting the request of a container) also if not used. This means most of the time the pods in these namespaces are unnecessarily consuming resources.

The basic idea of kube-green is to stop all pods in those namespaces.

kube-green idea

How it is possible?

kube-green is a Kubernetes controller, which define a Custom Resource Definition called SleepInfo. SleepInfo CRD define when stop and restart the pods in a namespace.

So, for example in development namespaces, it is possible to stop all the pods in non business hours: wake up every morning from monday to friday and stop every night from monday to friday.

An example of SleepInfo CRD to make it is:

apiVersion: kube-green.com/v1alpha1
kind: SleepInfo
metadata:
name: working-hours
spec:
weekdays: "1-5"
sleepAt: "20:00"
wakeUpAt: "08:00"
timeZone: "Europe/Rome"
suspendCronJobs: true

What resources can you suspend?

At the time of this post, with kube-green at v0.2.0, it is possible to sleep only Deployment. Other resources will be added in the future.
If you need some particular resources, write it in this issue to set it in roadmap!

Conclusion

Do you want to reduce the CO2 emissions and costs of your Kubernetes cluster?

Read our documentation to install kube-green in your cluster!