Tech companies can reduce environmental impact with Kubernetes

By Zinnia Gibson, Software Engineer, D2iQ.

You can easily visualise a car, deforested area, or a factory contributing to greenhouse gas emissions, but a developer working on a computer? The cloud? They’re powered by electricity, whose emissions happen far, far away from us – enough so that we probably don’t feel the need to think about it. But we do need to think about it: digital technologies comprise about 4% of emissions, with energy consumption rising 9% per year.

One overlooked area in terms of environmental impact is software development. I’m here to tell you developers can do something about it, which leads us to a solution you probably didn’t expect: Kubernetes.

But first, let’s hammer home the problem.

The part where I hammer home the problem – hungry data centres Data centres are some of the fastest-growing consumers of natural resources. Research from Yale all the way back in 2018 found that the cloud’s carbon footprint amounted to over 2% of the world’s electricity production – higher than aviation, reportedly 3% according to more recent data. A single data centre consumes the equivalent electricity of 50,000 homes!

A lot of that electricity – 88% in fact – isn’t even used for computational processes, just cooling and making sure the cloud stays up 24/7 via cooling redundancies. Sometimes there’s the faulty notion electricity has a cleaner footprint than other carbon producers, but in the EU, only 17% of electricity comes from renewable sources like solar and wind. Everything else is fossil fuels-based.

The European Climate Law includes a legal objective for the Union to reach climate neutrality by 2050. By 2030, the EU’s 2030 Climate Target Plan seeks a 55% reduction in emissions. That’s less than 7 years away.

It might sometimes feel like we’re powerless to do anything about that, but the tech industry holds a lot of weight in mitigating this problem through the infrastructure it uses. And this brings us back to how Kubernetes can affect our environmental impact.

How Kubernetes affects environmental impact

A big advantage Kubernetes brings to managing environmental impact is how it handles resources in the cloud in an energy-efficient manner. This is especially true compared to how those resources have previously been managed by un-containerised virtual machines (VM).

More specifically, the autoscaling mechanism of Kubernetes means you’re not leaving resources idle, or using too many for that matter. That’s great for testing environments. Whereas un-containerised VMs force you to leave a testing environment running all the time – even when you’re not testing – Kubernetes lets you scale a testing cluster up and down as needed. With VMs, even development becomes extremely complex, and more time spent developing means greater environmental impact.

In general, Kubernetes lets you intelligently reduce computer resources when unneeded, and given the AI hype craze we’re experiencing right now, it’s worth mentioning AI/ML workloads are already very taxing on CPUs/GPUs. As AI advances, that’s going to get worse, which means Kubernetes will become quite integral to optimising and streamlining those workloads at scale.

When you adopt Kubernetes matters

Your environmental impact is also affected by when you adopt Kubernetes. At my recent Kubecon presentation, I illustrated this by asking the audience to partake in a bit of a thought experiment…

Imagine you have two large-scale companies in the AAA game development space with the same product. Company A uses Kubernetes but Company B, which intends to eventually, still uses VMs.

The company using Kubernetes, because of its autoscaling capabilities, automatically uses fewer resources from data centres. Consider that a lot of resources are spent on cooling hardware, so if you have mismanaged resources at a large scale, even the smallest mistake consumes much energy to keep cool and online all the time.

The benefits scale down too…

But it’s not just large-scale companies whose environmental impact Kubernetes reduces. Small companies can benefit too.

Even small indie game developers today have large user bases (see Valheim, developed by just a handful of people). These companies are likely testing all the time, and Kubernetes offers a much easier route to scaling this testing up and down rather than leaving resources running 100% of the time.

But, again, ‘when’ matters too. Imagine you’re a small-scale indie developer that released a runaway success. Your userbase explodes, and suddenly you need to scale up your application – or maybe you’re being acquired by a larger company whose infrastructure you need to merge yours with. If you’ve not already integrated Kubernetes into your workload, you have much more training and infrastructure migration worries to think about.

While we don’t consciously think about how this affects the environment, it all inevitably leads to more time and energy spent on computing. And it’s always easier adopting a technology when your company is still small and agile versus implementing it much later.

Kubernetes isn’t perfect

Now, to be clear, Kubernetes isn’t the environment’s sole saviour. One issue we often see whenever a new technology takes off the way Kubernetes has is that people over-engineer things.

Not everything needs to be containerised. As much as the Kubernetes’ automation optimises resourcing, containerisation by its nature does add some complexity, which you sometimes don’t need. We’ve seen this in practice recently when Amazon’s Prime Video audio/video monitoring service moved from a distributed microservices architecture to a monolith application, cutting 90% of the cost in the process. If a service doesn’t meaningfully benefit from containerisation, then all you’re doing with the added complexity is to expend an unnecessary net positive in electricity.

Look upstream

For the rest of the time when Kubernetes does make a difference, migrating early can positively affect long-term environmental impact. But how?

Some have achieved wildly impressive feats. A single developer at Netspeak Games migrated the company’s workloads to Kubernetes in just six months using open source libraries to containerise the game engine they were using to power their development (Unreal Engine).

That is to say, if you’re a developer in this space, there are tons of upstream projects you should take advantage of to enable this transition, ultimately decreasing development time, lowering cost, and lowering environmental impact as a knock-on effect.

While there are too many to list, here are some favourites: · GreenFrame: an open source tool which measures and reduces your website’s CO2 emissions by detecting carobn leaks. · Prometheus: a way to obtain metrics so you know when resource loss is occurring. · The CNCF Environmental Sustainability Working Group also holds biweekly meetings on how tech companies can help raise awareness of environmental consciousness and impact for the industry.

Of course, there are many other avenues tech companies should resort to, from renewable energy efficiency improvements (like making their offices more environmentally friendly, carbon sequestration, etc.), but with the climate outlook looking as dire as it is, we have an obligation to make use of as many tools as we can. And Kubernetes should absolutely be part of that mix.

By John Abel, Technical Director, Google Cloud.
By Javier Martinez, DevOps Content Engineer, Sysdig.
By Nurit Bielorai, Go-To-Market Manager, Supply Chain Security at Aqua Security.
By Surya Duvvuri, Vice President – Life Sciences Head for DACH and Nordics.
By Priya Rajagopal, Director Product Management, Developer Platforms at Couchbase.