NEW! Mirantis Academy -   Learn confidently with expert guidance and On-demand content.   Learn More


Greener clouds: Four steps to more sustainable cloud applications and infrastructure

Eric Gregory - May 02, 2023

“If you have the ability to easily move workloads from one cluster to another,” a Cloud Infrastructure Specialist from Société Générale once told me, “you also have the ability to move clusters based on environmental footprint.”

Those words stuck with me. They crisply and concisely articulate the power of orchestrators like Kubernetes to foster more sustainable clouds.

And we need more sustainable clouds, because the non-profit Shift Project finds that cloud computing is responsible for between 2.7 and 3.7% of global CO2 emissions—similar to or more than commercial aviation. Organizations need to implement controls on cloud-driven energy consumption—and many face rising pressure to do so from investors and regulators alike.

An holistic approach to sustainable cloud usage means organizations need both a careful approach to infrastructure and strategies to optimize their applications. Here are four steps to help you get started.

1. Reduce application footprint

In addition to your infrastructure footprint, consider your workloads themselves. Containers generally give you substantially smaller application footprints than virtual machines, since they share an OS kernel and common dependencies. But many container images are still much larger than they need to be, leading to wasteful network traffic (and latency).

There are numerous base images designed to help you slim down your workloads when you build container images, often by excluding Linux components (debugging tools, for example) that the application won’t need when running in production. These include:

  • alpine - A lightweight Linux distribution commonly used for base images

  • distroless - A suite of base images designed by Google to exclude any elements other than application code and runtime dependencies

  • Wolfi - An “undistro” designed by Chainguard, deliberately lacking a Linux kernel and other OS components like package managers

How much of a difference does a base image make? A simple application with a vanilla Debian base might easily be 100MB (or much more), while a similar app on a distroless base image could be around 5MB. 

Using a small base image isn’t the only way to reduce your application footprint. Compiled Rust, for example, will give you a smaller container image than a similar application in many other languages. You may also want to consider other approaches to your code that can yield major efficiency gains:

  • Serverless functions - Projects like Knative help you to run serverless functions on Kubernetes, enabling not only low-footprint code but scaling from zero—spinning up resources as needed and reducing idle processes.

  • WebAssembly modules - As WebAssembly (or Wasm) integration with Kubernetes accelerates rapidly via the runwasi interface, it’s becoming easier and easier to run very lightweight WebAssembly applications written in a variety of languages—a particularly strong option for code running at the edge.

There are many factors to consider when engineering for sustainability. The Principles of Green Software Engineering provide a thorough and considered place to start, including detailed recommendations for designing microservices.

2. Use Kubernetes to optimize energy consumption

As a resource-aware system, Kubernetes can help to reduce energy consumption and utilize resources more efficiently. Imagine infrastructure that can intelligently schedule workloads to the public cloud region with the lowest carbon intensity, or even onto more efficient server architectures like Aarch64.(Earlier this year, Aaron Williams gave an excellent presentation on the utility of Aarch64/ARM64 architectures for lowering energy consumption.) This is entirely feasible with Kubernetes.

The strength of Kubernetes lies in its ecosystem and extensibility. With the Operator Framework and Kubernetes client libraries like client-go, you can build your own operators and other extensions to Kubernetes in order to automate scheduling and tailor processes to your precise needs. You can even use the Cluster API project to manage Kubernetes clusters via Kubernetes, and deploy entire clusters in accordance with your sustainability goals.

3. Use a lightweight Kubernetes distribution

You don’t just need to think about the footprint of your applications—it’s important to consider the footprint of your Kubernetes distribution as well. Lightweight distributions like k0s and k3s pare down Kubernetes to the essentials, bringing benefits for security (reduced attack surface), usability (reduced complexity), and efficiency. 

If you’re looking to use a more energy-efficient architecture, k0s is a good fit, supporting ARM64 and ARMv7, and intended for use in environments ranging all the way from the edge to large-scale public cloud.

4. Monitor and extend your Kubernetes environment

In order to be effective, you need to use Kubernetes correctly and deliberately—a misconfigured cluster can simply lead to waste at scale. In order to understand whether your cluster is properly tuned or not, you need useful metrics on cluster activity.

Open source observability tools like Prometheus help you gain insight into what's happening on a cluster, producing standardized metrics that other applications can interact with via API. Open source projects like Trivy can check a cluster and the Kubernetes resources on that cluster against configuration benchmarks, which can be helpful not only for security, but cost and energy efficiency as well.

Kepler, a project recently submitted to the Cloud Native Computing Foundation, utilizes eBPF and machine learning to measure and project power consumption on a cluster, and exports the data as a set of Prometheus metrics.


These aren’t the only ways to achieve more efficient and sustainable cloud native applications—but they represent a strong foundation. 

Cloud native sustainability is a multi-dimensional practice, urgent in its own right and often dovetailing with organizations’ mandates for broader efficiency. For an holistic approach to sustainability, organizations need to develop careful approaches to infrastructure and development.

If you would like to discuss strategies for more sustainable clouds at your organization, contact us.

Choose your cloud native journey.

Whatever your role, we’re here to help with open source tools and world-class support.


Subscribe to our bi-weekly newsletter for exclusive interviews, expert commentary, and thought leadership on topics shaping the cloud native world.