Slide 1

Slide 1 text

qaware.de Navigating the Cloud-native Sustainability Landscape towards Green K8s Clusters Mario-Leander Reimer [email protected] @LeanderReimer https://cisweb.lancaster.ac.uk/

Slide 2

Slide 2 text

2 Mario-Leander Reimer Managing Director | CTO @LeanderReimer #cloudnativenerd #qaware #gernperDude

Slide 3

Slide 3 text

3 Mario-Leander Reimer Managing Director | CTO @LeanderReimer #cloudnativenerd #qaware #gernperDude

Slide 4

Slide 4 text

4 IT Create sustainability impact in other industries Show responsibility for own consumption of resources

Slide 5

Slide 5 text

sustainable kubernetes

Slide 6

Slide 6 text

cncf/tag-env-sustainability TAG Environmental Sustainability šŸŒ³šŸŒā™»

Slide 7

Slide 7 text

https://tag-env-sustainability.cncf.io/landscape/

Slide 8

Slide 8 text

Shared Responsibility means it is our responsibility to use the required cloud resources in a sustainable manner. 8 QAware

Slide 9

Slide 9 text

Sustainability Engineering to optimize the CO2 footprint of your K8s clusters and workloads. 9 QAware Monitoring What is the energy consumption and CO2 footprint of my cluster and workloads? Measure, Measure, Measure, Act. Elasticity Oversized or underutilized resources? Infrastructure and workloads should be proportionate to actual demand. Architecture Where is the cluster running? On which hardware? Take sustainability into account when building the infrastructure. Waste Shutdown or deplete the wasted resources. Not required, redundant or forgotten environments or workloads?

Slide 10

Slide 10 text

10 QAware ELECTRICITYMAPS.COM

Slide 11

Slide 11 text

Business requirements and sustainability goals need to be aligned and reconciled. The choice of region for the cluster and workloads has a signiļ¬cant impact on their KPIs, including performance, cost, and carbon footprint. ā–  Ensure that the region meets the required legal regulations (e.g. GDPR) ā–  Ensure that the region supports the required services and features. ā€“ Which hardware classes are supported? ā€“ Databases? Storage? ā€¦ ā–  Calculate costs for the cluster and workloads for the selected region. ā–  Test network latency between your end user locations and region! 11 QAware https://docs.aws.amazon.com/wellarchitected/latest/sustainability-pillar/sus_sus_region_a2.html AWS Graviton 2 can save up to 65% on energy consumption AWS Graviton 2 can save up to 15% on costs

Slide 12

Slide 12 text

Cluster Rightsizing mit Cluster-Autoscaler und Karpenter 12 QAware Node 1 Node 2 Node 3 X Node 4

Slide 13

Slide 13 text

Workload Rightsizing with VPA and Goldilocks 13 QAware https://github.com/FairwindsOps/goldilocks apiVersion: "autoscaling.k8s.io/v1" kind: VerticalPodAutoscaler metadata: name: hamster-vpa spec: targetRef: apiVersion: "apps/v1" kind: Deployment name: hamster updatePolicy: # updateMode: "Auto" updateMode: "Off" resourcePolicy : containerPolicies : - containerName: '*' minAllowed: cpu: 100m memory: 50Mi maxAllowed: cpu: 1 memory: 500Mi controlledResources : ["cpu", "memory"] deļ¬ned and tune requests and limits for CPU and RAM perform realistic performance tests analyse measurements of resource consumption https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler

Slide 14

Slide 14 text

kube-green An operator to reduce CO2 footprint of your clusters 14 QAware apiVersion: kube-green.com/v1alpha1 kind: SleepInfo metadata: name: non-working-hours spec: weekdays: "1-5" sleepAt: "18:00" wakeUpAt: "08:00" timeZone: "Europe/Rome" suspendCronJobs : true excludeRef: - apiVersion: "apps/v1" kind: Deployment name: no-sleep-deployment - matchLabels : kube-green.dev/exclude : "true" https://kube-green.dev/docs/FAQ/#how-many-co2-is-produced-by-pod

Slide 15

Slide 15 text

High-Level View on Scaling in Kubernetes 15 QAware

Slide 16

Slide 16 text

Resource Metrics, Custom Metrics, External Metrics API 16 QAware

Slide 17

Slide 17 text

Sustainable Computing Projects ā–  Kepler (Kubernetes-based Efficient Power Level Exporter) uses eBPF to probe energy related system stats and exports as Prometheus metrics. ā–  PEAKS (Power Efficiency Aware Kubernetes Scheduler) uses metrics exported by Kepler to help Kubernetes schedule to improve energy efficiency by placing Pods on optimal nodes. ā–  CLEVER (Container Level Energy-efficient VPA Recommender) uses metrics exported by Kepler to recommend Vertical Pod Autoscaler the resource proļ¬les to improve energy efficiency by running workloads. 17 QAware https://www.sustainable-computing.io

Slide 18

Slide 18 text

Monitor and Measure the Energy Consumption of Nodes and Pods using Kepler 18 QAware

Slide 19

Slide 19 text

Carbon-aware Scaling mit KEDA ā–  https://keda.sh ā–  KEDA ist ein Kubernetes-basierter ereignisgesteuerter und zweck-orientierter Autoscaler. ā–  UnterstĆ¼tzt 50+ Scaler Out-of-the-box, e.g. Cron, RabbitMQ, ā€¦ ā–  Carbon Aware Scheduling - Kubernetes Carbon Intensity Exporter - Carbon Aware KEDA Operator 19 QAware

Slide 20

Slide 20 text

Carbon aware Spatial a with Karmada 20 QAware https://rossfairbanks.com/2023/07/12/carbon-aware-spatial-shifting-with-karmada/ karmada control plane Cluster A API Server Cluster B API Server Agent karmada API server etcd karmada scheduler karmada API server Cluster Controller Policy Controller Binding Controller Execution Controller W1 W1 W1 W1

Slide 21

Slide 21 text

Carbon aware Spatial Shifting with Karmada 21 QAware https://rossfairbanks.com/2023/07/12/carbon-aware-spatial-shifting-with-karmada/ karmada control plane Cluster A API Server Cluster B API Server Agent karmada API server etcd karmada scheduler karmada API server Cluster Controller Policy Controller Binding Controller Execution Controller W1 W1 W1 W1

Slide 22

Slide 22 text

lreimer/green-kubernetes

Slide 23

Slide 23 text

Team Topologies and Platform Engineering are key enabler for Sustainable Cloud Infrastructure and Software Development QAware | 23 https://martinfowler.com/bliki/TeamTopologies.html [email protected]

Slide 24

Slide 24 text

qaware.de QAware GmbH Aschauer StraƟe 32 81549 MĆ¼nchen Tel. +49 89 232315-0 [email protected] twitter.com/qaware linkedin.com/company/qaware-gmbh xing.com/companies/qawaregmbh slideshare.net/qaware github.com/qaware