SlideShare a Scribd company logo
2
Most read
3
Most read
6
Most read
Autoscaling Kubernetes
Jerzy Szczepkowski
jsz@google.com
A quick recap
Node / Kubelet
Pod
ContainerContainerContainer
Pod
Container
Node / Kubelet
Pod
Container
Container
Pod
ContainerContainerContainer
Node / Kubelet
Pod
Node / Kubelet
Pod
Container
Container
Pod
Master
Replication
Controller
Replication
Controller
ContainerContainerContainerContainer
Kubernetes
Revision
Autoscaling
Autoscaling: the ability of a system to automatically adjust the
amount of used computational resources based on the load
Benefits:
● reduce cost (on cloud provider)
● reduce power consumption
Horizontal: scale the number of instances
Vertical: scale the resources used by an instance
Autoscaling Kubernetes
Kubernetes
Nodes Pods
Horizontal # of nodes # of pods
Vertical
resources for a
node
resources for a pod
Kubernetes
Horizontal autoscaling of nodes
Nodes Pods
Horizontal # of nodes # of pods
Vertical
resources for a
node
resources for a pod
Example: on Google Cloud Platform
Autoscaling nodes
Google Compute Engine:
● Infrastructure as a Service (IaaS)
● user can create virtual machines on demand
● charged on a base of per-minute cost
Google Compute Engine is an exemplary platform for Kubernetes:
● user may set-up his own cluster on Google Compute Engine
● user may buy a predefined cluster (Google Container Engine)
In both cases, Google Compute Engine virtual machine are used as hosts for Kubernetes
master and nodes.
Managed Instance Group
Autoscaling nodes
Manage virtual machines in bulk!
Managed Instance Groups (Google Compute Engine) collectively manage groups of similar virtual
machine instances (in the same zone).
A Managed Instance Group creates virtual machines on a base of instance template:
‒ image (e.g.: debian distribution)
‒ startup script (e.g.: install pkgs and start services)
‒ shutdown script (e.g: gracefully stop services)
‒ + more...
Managed Instance Groups can be manually resized.
Managed Instance Groups are now available for Google Compute Engine users.
Autoscaling MIGs
Autoscaling nodes
Let the Cloud Autoscaler choose the best size of Managed Instance Group for you!
Intent based:
● User specifies average target utilization level for VMs.
● Cloud Autoscaler collects and interprets utilization data and determines how many VMs should be added
or removed from the Managed Instance Group to achieve close to the target utilization.
Autoscaling policies (currently supported):
● CPU utilization,
● HTTP load balancing serving capacity,
● Custom Cloud Monitoring Metrics.
Autoscaling behaviour: increase rapidly, decrease gracefully.
Cloud Autoscaler is now available as for Google Compute Engine users.
Kubernetes on a MIG
Autoscaling nodes
NodeController automatically discovers nodes by querying cloud provider
(based on a regular expression for node names).
Let’s create a Managed Instance Group for nodes!
Resize of Managed Instance Group → resize of cluster.
Master remains on a separate VM (not in the Managed Instance Group), unaffected by
resize.
Problems
Autoscaling nodes
● Each node needs to have an IP range (for pods):
NodeController distributes IP ranges to nodes during assimilation of a new node.
● Graceful removal of node:
○ mark node an unschedulable in spec (no new pods will be scheduled on it)
○ notify containers that the nodes will be removed
(they can stop accepting new traffic, finish writing persistent data, etc)
○ wait for a while before removal
May be triggered by shutdown script in Managed Instance Group.
● Rebalancing of pods on node addition:
○ adding new node will not affect already schedule pods
○ the new node may be empty, potentially for a long time
○ first add node, then increase replication controllers
May be solved by rescheduling/rebalancing.
Done
Proposal
???
Autoscaling Kubernetes nodes
Autoscaling nodes
Just use Cloud Autoscaler to scale Managed Instance Group for nodes!
Considered signals for scaling:
● resource utilization (CPU, memory)
● signals from scheduler (e.g.: # of pending pods)
Horizontal autoscaling of Pods
Kubernetes
Nodes Pods
Horizontal # of nodes # of pods
Vertical
resources for a
node
resources for a pod
Autoscaling Replication Controllers
Autoscaling pods
Effort started by Red Hat.
AutoScaler:
● abstraction on the top of ReplicationController,
● calls resize on RC,
● RC is unaware of AutoScaler.
Two approaches:
● intention based - try to maintain the given value;
● rule based - if the given value is reached, execute the given action
(increment/decrement).
Proposal
Problems
Autoscaling pods
Simplest solution: AutoScaler acts on a single ReplicationController.
However: we often have many RCs for service (e.g.: rolling update).
Improved solution: AutoScaler acts on set of RCs (with matching labels):
● monitor selector - RCs to monitor
● target selector - RCs to act on (the largest of them)
● during deployment / rolling update - option to disable decrement
How to collect signals:
● cAdvisor → Heapster → InfluxDB
● Google Cloud Monitoring (Google Container Engine)
Proposal
???
Autoscaling during rolling update
Autoscaling pods
Replication
Controller
version 1.4
Auto
Scaler
Pod
Pod
Pod
Pod
↕
Autoscaling during rolling update
Autoscaling pods
Replication
Controller
version 1.4
Auto
Scaler
Pod
Pod
Pod
↑
Replication
Controller
version 1.6
Pod
Pod
Autoscaling during rolling update
Autoscaling pods
Replication
Controller
version 1.4
Auto
Scaler
Pod
Pod
Replication
Controller
version 1.6
Pod
Pod
Pod
↑
Autoscaling during rolling update
Autoscaling pods
Replication
Controller
version 1.6
Auto
Scaler
Pod
Pod
Pod
Pod
↕
Problems
Autosclaing pods
Simplest solution: AutoScaler acts on a single ReplicationController.
However: we often have many RCs for service (e.g.: rolling update).
Improved solution: AutoScaler acts on set of RCs (with matching labels):
● monitor selector - RCs to monitor
● target selector - RCs to act on (the largest of them)
● during deployment / rolling update - option to disable decrement
How to collect signals:
● cAdvisor → Heapster → InfluxDB
● Google Cloud Monitoring (Google Container Engine)
Proposal
???
Questions?

More Related Content

What's hot (20)

PDF
Introduction to Kubernetes Workshop
Bob Killen
 
PPTX
DevOps with Kubernetes
EastBanc Tachnologies
 
PPTX
Autoscaling with Kubernetes
Johannes Würbach
 
PDF
Kubernetes 101
Crevise Technologies
 
PDF
Introduction to kubernetes
Gabriel Carro
 
PPTX
Kubernetes #2 monitoring
Terry Cho
 
PDF
Kubernetes Introduction
Peng Xiao
 
PDF
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Edureka!
 
PDF
Designing a complete ci cd pipeline using argo events, workflow and cd products
Julian Mazzitelli
 
PDF
Kubernetes
erialc_w
 
PPTX
Kubernetes 101 for Beginners
Oktay Esgul
 
ODP
Kubernetes Architecture
Knoldus Inc.
 
PDF
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
SlideTeam
 
PPTX
Kubernetes PPT.pptx
ssuser0cc9131
 
PDF
Kubernetes
Meng-Ze Lee
 
PDF
Getting Started with Kubernetes
VMware Tanzu
 
PPT
Jenkins Overview
Ahmed M. Gomaa
 
PDF
[OpenStack] 공개 소프트웨어 오픈스택 입문 & 파헤치기
Ian Choi
 
PDF
Quick introduction to Kubernetes
Eduardo Garcia Moyano
 
PPTX
Docker: From Zero to Hero
fazalraja
 
Introduction to Kubernetes Workshop
Bob Killen
 
DevOps with Kubernetes
EastBanc Tachnologies
 
Autoscaling with Kubernetes
Johannes Würbach
 
Kubernetes 101
Crevise Technologies
 
Introduction to kubernetes
Gabriel Carro
 
Kubernetes #2 monitoring
Terry Cho
 
Kubernetes Introduction
Peng Xiao
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Edureka!
 
Designing a complete ci cd pipeline using argo events, workflow and cd products
Julian Mazzitelli
 
Kubernetes
erialc_w
 
Kubernetes 101 for Beginners
Oktay Esgul
 
Kubernetes Architecture
Knoldus Inc.
 
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
SlideTeam
 
Kubernetes PPT.pptx
ssuser0cc9131
 
Kubernetes
Meng-Ze Lee
 
Getting Started with Kubernetes
VMware Tanzu
 
Jenkins Overview
Ahmed M. Gomaa
 
[OpenStack] 공개 소프트웨어 오픈스택 입문 & 파헤치기
Ian Choi
 
Quick introduction to Kubernetes
Eduardo Garcia Moyano
 
Docker: From Zero to Hero
fazalraja
 

Similar to Autoscaling Kubernetes (20)

PDF
Autoscaling in kubernetes v1
JurajHantk
 
PPTX
Migrating from EKS Cluster Autoscaler to Karpenter
AshishGajjar10
 
PDF
Kubernetes: Reducing Infrastructure Cost & Complexity
DevOps.com
 
PPTX
Autoscaling in Kubernetes
Hrishikesh Deodhar
 
PPTX
KCD PPT -2025 - Kasun Rathnayaka (2).pptx
KasunRathnayaka10
 
PDF
August-20_Autoscaling-and-Cost-Optimization-on-Kubernetes-From-0-to-100.pdf
LumbanSopian1
 
PPTX
Introduction to Container Storage Interface (CSI)
Idan Atias
 
PDF
KubeCon Prometheus Salon -- Kubernetes metrics deep dive
Bob Cotton
 
PPTX
Kubernetes #1 intro
Terry Cho
 
PDF
[GS네오텍] Google Kubernetes Engine
GS Neotek
 
PPTX
Docker on Amazon ECS
Deepak Kumar
 
PDF
Journey of Kubernetes Scaling
Opsta
 
PDF
Kubernetes basics, Nodes, Pods, Containers, Deployments
Beroza Paul
 
PDF
Monitoring kubernetes across data center and cloud
Datadog
 
PDF
Running Projects in Application Containers, System Containers & VMs - Jelasti...
Jelastic Multi-Cloud PaaS
 
PDF
Kubernetes Cloud Native Indonesia Meetup - May 2025
Prasta Maha
 
PDF
Kubernetes intro
Pravin Magdum
 
PPTX
Docker and Kubernetes Training | Kubernetes Online Training
navyatejavisualpath
 
PDF
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
Bob Cotton
 
PPTX
Kubernetes Reference Architectures GCP.pptx
suryadeepchatterjee5
 
Autoscaling in kubernetes v1
JurajHantk
 
Migrating from EKS Cluster Autoscaler to Karpenter
AshishGajjar10
 
Kubernetes: Reducing Infrastructure Cost & Complexity
DevOps.com
 
Autoscaling in Kubernetes
Hrishikesh Deodhar
 
KCD PPT -2025 - Kasun Rathnayaka (2).pptx
KasunRathnayaka10
 
August-20_Autoscaling-and-Cost-Optimization-on-Kubernetes-From-0-to-100.pdf
LumbanSopian1
 
Introduction to Container Storage Interface (CSI)
Idan Atias
 
KubeCon Prometheus Salon -- Kubernetes metrics deep dive
Bob Cotton
 
Kubernetes #1 intro
Terry Cho
 
[GS네오텍] Google Kubernetes Engine
GS Neotek
 
Docker on Amazon ECS
Deepak Kumar
 
Journey of Kubernetes Scaling
Opsta
 
Kubernetes basics, Nodes, Pods, Containers, Deployments
Beroza Paul
 
Monitoring kubernetes across data center and cloud
Datadog
 
Running Projects in Application Containers, System Containers & VMs - Jelasti...
Jelastic Multi-Cloud PaaS
 
Kubernetes Cloud Native Indonesia Meetup - May 2025
Prasta Maha
 
Kubernetes intro
Pravin Magdum
 
Docker and Kubernetes Training | Kubernetes Online Training
navyatejavisualpath
 
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
Bob Cotton
 
Kubernetes Reference Architectures GCP.pptx
suryadeepchatterjee5
 
Ad

Recently uploaded (20)

PPTX
PCU Keynote at IEEE World Congress on Services 250710.pptx
Ramesh Jain
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
visibel.ai Company Profile – Real-Time AI Solution for CCTV
visibelaiproject
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
PPTX
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PPTX
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
PDF
SalesForce Managed Services Benefits (1).pdf
TechForce Services
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PCU Keynote at IEEE World Congress on Services 250710.pptx
Ramesh Jain
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
The Future of Artificial Intelligence (AI)
Mukul
 
visibel.ai Company Profile – Real-Time AI Solution for CCTV
visibelaiproject
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
SalesForce Managed Services Benefits (1).pdf
TechForce Services
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
The Past, Present & Future of Kenya's Digital Transformation
Moses Kemibaro
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Ad

Autoscaling Kubernetes

  • 2. A quick recap Node / Kubelet Pod ContainerContainerContainer Pod Container Node / Kubelet Pod Container Container Pod ContainerContainerContainer Node / Kubelet Pod Node / Kubelet Pod Container Container Pod Master Replication Controller Replication Controller ContainerContainerContainerContainer Kubernetes
  • 3. Revision Autoscaling Autoscaling: the ability of a system to automatically adjust the amount of used computational resources based on the load Benefits: ● reduce cost (on cloud provider) ● reduce power consumption Horizontal: scale the number of instances Vertical: scale the resources used by an instance
  • 4. Autoscaling Kubernetes Kubernetes Nodes Pods Horizontal # of nodes # of pods Vertical resources for a node resources for a pod
  • 5. Kubernetes Horizontal autoscaling of nodes Nodes Pods Horizontal # of nodes # of pods Vertical resources for a node resources for a pod
  • 6. Example: on Google Cloud Platform Autoscaling nodes Google Compute Engine: ● Infrastructure as a Service (IaaS) ● user can create virtual machines on demand ● charged on a base of per-minute cost Google Compute Engine is an exemplary platform for Kubernetes: ● user may set-up his own cluster on Google Compute Engine ● user may buy a predefined cluster (Google Container Engine) In both cases, Google Compute Engine virtual machine are used as hosts for Kubernetes master and nodes.
  • 7. Managed Instance Group Autoscaling nodes Manage virtual machines in bulk! Managed Instance Groups (Google Compute Engine) collectively manage groups of similar virtual machine instances (in the same zone). A Managed Instance Group creates virtual machines on a base of instance template: ‒ image (e.g.: debian distribution) ‒ startup script (e.g.: install pkgs and start services) ‒ shutdown script (e.g: gracefully stop services) ‒ + more... Managed Instance Groups can be manually resized. Managed Instance Groups are now available for Google Compute Engine users.
  • 8. Autoscaling MIGs Autoscaling nodes Let the Cloud Autoscaler choose the best size of Managed Instance Group for you! Intent based: ● User specifies average target utilization level for VMs. ● Cloud Autoscaler collects and interprets utilization data and determines how many VMs should be added or removed from the Managed Instance Group to achieve close to the target utilization. Autoscaling policies (currently supported): ● CPU utilization, ● HTTP load balancing serving capacity, ● Custom Cloud Monitoring Metrics. Autoscaling behaviour: increase rapidly, decrease gracefully. Cloud Autoscaler is now available as for Google Compute Engine users.
  • 9. Kubernetes on a MIG Autoscaling nodes NodeController automatically discovers nodes by querying cloud provider (based on a regular expression for node names). Let’s create a Managed Instance Group for nodes! Resize of Managed Instance Group → resize of cluster. Master remains on a separate VM (not in the Managed Instance Group), unaffected by resize.
  • 10. Problems Autoscaling nodes ● Each node needs to have an IP range (for pods): NodeController distributes IP ranges to nodes during assimilation of a new node. ● Graceful removal of node: ○ mark node an unschedulable in spec (no new pods will be scheduled on it) ○ notify containers that the nodes will be removed (they can stop accepting new traffic, finish writing persistent data, etc) ○ wait for a while before removal May be triggered by shutdown script in Managed Instance Group. ● Rebalancing of pods on node addition: ○ adding new node will not affect already schedule pods ○ the new node may be empty, potentially for a long time ○ first add node, then increase replication controllers May be solved by rescheduling/rebalancing. Done Proposal ???
  • 11. Autoscaling Kubernetes nodes Autoscaling nodes Just use Cloud Autoscaler to scale Managed Instance Group for nodes! Considered signals for scaling: ● resource utilization (CPU, memory) ● signals from scheduler (e.g.: # of pending pods)
  • 12. Horizontal autoscaling of Pods Kubernetes Nodes Pods Horizontal # of nodes # of pods Vertical resources for a node resources for a pod
  • 13. Autoscaling Replication Controllers Autoscaling pods Effort started by Red Hat. AutoScaler: ● abstraction on the top of ReplicationController, ● calls resize on RC, ● RC is unaware of AutoScaler. Two approaches: ● intention based - try to maintain the given value; ● rule based - if the given value is reached, execute the given action (increment/decrement). Proposal
  • 14. Problems Autoscaling pods Simplest solution: AutoScaler acts on a single ReplicationController. However: we often have many RCs for service (e.g.: rolling update). Improved solution: AutoScaler acts on set of RCs (with matching labels): ● monitor selector - RCs to monitor ● target selector - RCs to act on (the largest of them) ● during deployment / rolling update - option to disable decrement How to collect signals: ● cAdvisor → Heapster → InfluxDB ● Google Cloud Monitoring (Google Container Engine) Proposal ???
  • 15. Autoscaling during rolling update Autoscaling pods Replication Controller version 1.4 Auto Scaler Pod Pod Pod Pod ↕
  • 16. Autoscaling during rolling update Autoscaling pods Replication Controller version 1.4 Auto Scaler Pod Pod Pod ↑ Replication Controller version 1.6 Pod Pod
  • 17. Autoscaling during rolling update Autoscaling pods Replication Controller version 1.4 Auto Scaler Pod Pod Replication Controller version 1.6 Pod Pod Pod ↑
  • 18. Autoscaling during rolling update Autoscaling pods Replication Controller version 1.6 Auto Scaler Pod Pod Pod Pod ↕
  • 19. Problems Autosclaing pods Simplest solution: AutoScaler acts on a single ReplicationController. However: we often have many RCs for service (e.g.: rolling update). Improved solution: AutoScaler acts on set of RCs (with matching labels): ● monitor selector - RCs to monitor ● target selector - RCs to act on (the largest of them) ● during deployment / rolling update - option to disable decrement How to collect signals: ● cAdvisor → Heapster → InfluxDB ● Google Cloud Monitoring (Google Container Engine) Proposal ???