SlideShare a Scribd company logo
1 of 55
Kubernetes
Auto scaling
On production at M6Web
Photo by frank mckenna on Unsplash
Kubernetes
Container orchestrator
Maximize capacity
Adapt to demand
Keep applications healthy
Kubernetes
● Handles Network
● Container Autoscaling
● Containers High Availability
● Given available resources:
CPU, RAM, etc.
● YAML config
Kubernetes
Objects
1. Pod
2. Node
3. Cluster
4. Horizontal Pod
Autoscaler
5. Service
Kubernetes
Objects
1. Pod
2. Node
3. Cluster
4. Horizontal Pod
Autoscaler
5. Service
Kubernetes
Objects
1. Pod
2. Node
3. Cluster
4. Horizontal Pod
Autoscaler
5. Service
Kubernetes
Objects
1. Pod
2. Node
3. Cluster
4. Horizontal Pod
Autoscaler
5. Service
Kubernetes
Objects
1. Pod
2. Node
3. Cluster
4. Horizontal Pod
Autoscaler
5. Service
Kubernetes
Objects
1. Pod
2. Node
3. Cluster
4. Horizontal Pod
Autoscaler
5. Service
Kubernetes
Objects
1. Pod
2. Node
3. Cluster
4. Horizontal Pod
Autoscaler
5. Service
Kubernetes
Objects
1. Pod
2. Node
3. Cluster
4. Horizontal Pod
Autoscaler
5. Service
Example with our
geolocation API
Pod
2 containers:
● Nginx
○ Rewrite rules
○ HTTP headers sanitation
○ HTTP enhancements
(gzip, etc.)
● PHP-FPM
○ Executes PHP code
Deployment
This Pod is executed inside a cluster
Production Cluster
● Master nodes
● Worker nodes
Pod in production
● 2 replicas of pod
● scheduled by Kubernetes on
different worker nodes
Horizontal Pod
Autoscaler
● Controls pod replicas
● Dynamically changed according
to CPU usage
Service
● Unchanged over time
● No matter how many pods exist
● Round Robin over pods
It works !!
Auto scales depending on the load
THIS IS FUN !!
Yeah really !!
Photo by Lightscape on Unsplash
It’s only
YAML
Configure HPA inside your project
To scale on 80% of Requests
Requests
Containers can request ressources
● CPU
● RAM
Those ressources are guaranteed
Helps Kubernetes to optimize the
scheduling of pods
Photo by Kaizen Nguyễn on Unsplash
Requests are the
highest resources
an app will
normally consume
They must not be considered as
minimum or maximum usable
resources
Requests are not Limits
Autoscaling
1. Horizontal Pod Autoscaler
2. Requests
Scalability based on CPU
How it works ?
Horizontal Pod Autoscaler
compares mean utilization of pods to
Requests values
Example:
geolocation at
16h30
● Pod Requests: 300m
(millicores)
● Horizontal Pod Autoscaler
target: 80%
● HPA scales from 240m
Example:
geolocation at
16h30
● Pod Requests: 300m
(millicores)
● Horizontal Pod Autoscaler
target: 80%
● HPA scales from 240m
CPU: 215m CPU: 205m
Mean CPU: 210m
70% of Requests
No need to scale
Example:
geolocation at
18h30
● Pod Requests: 300m
(millicores)
● Horizontal Pod Autoscaler
target: 80%
● HPA scales from 240m
CPU: 282m CPU: 264m
Mean CPU: 273m
91% of Requests
need to scale up
Photo by Roman Schurte on Unsplash
Of how much it scales ?
desiredReplicas = ceil[
currentReplicas *
( currentMetricValue / desiredMetricValue )]
Example A: 18h30
2 *
( 0.708 / 0.480 )
= 2.95
+1 pod
Example B: 20h47
10 *
( 3.361 / 2.4 )
= 14
+4 pods
Photo by Willian Justen de Vasconcellos on Unsplash
How can a developer define
requests?
Kubernetes
metrics
With Prometheus
● Pod usage
● Use by container
● Observation over time
● Define pod limits
● Load test
Example of a dashboard that shows CPU/RAM utilization of a pod
It will evolve over time
Metrics are
per container?
Yes, and so
are Requests
I lied earlier.
Metrics are not by pod.
Containers Requests inside Pods
Containers Requests inside Pods
By container metrics
● Horizontal Pod Autoscaler compares containers metrics overall pods
● It does the same calculation as above, but for each different container
● We can therefore scale up because of Nginx or PHP independently
● It always takes the highest value to define the number of replicas
Photo by rawpixel on Unsplash
cluster-
autoscaler
Node scaling:
+ Unschedulable pods
- Underutilized nodes
autoscaling
based on
Metrics
Custom metrics:
● Redis queue
● PHP-FPM listen queue
● etc.
Thanks Photo by Benjamin Voros on Unsplash
Photo by Kalle Kortelainen on Unsplash
questions and
answers available in
comments

More Related Content

What's hot

CNCF Rajkot group- Know the magic of kubernetes with AWS EKS
CNCF Rajkot group- Know the magic of kubernetes with AWS EKSCNCF Rajkot group- Know the magic of kubernetes with AWS EKS
CNCF Rajkot group- Know the magic of kubernetes with AWS EKSamanmakwana3
 
Helm chart-introduction
Helm chart-introductionHelm chart-introduction
Helm chart-introductionGanesh Pol
 
[GS네오텍] Google Kubernetes Engine
[GS네오텍]  Google Kubernetes Engine [GS네오텍]  Google Kubernetes Engine
[GS네오텍] Google Kubernetes Engine GS Neotek
 
From AWS to GCP, TABLEAPP Architecture Story
From AWS to GCP, TABLEAPP Architecture StoryFrom AWS to GCP, TABLEAPP Architecture Story
From AWS to GCP, TABLEAPP Architecture StoryYen-Wen Chen
 
Business Continuity with Microservices-Based Apps and DevOps: Learnings from ...
Business Continuity with Microservices-Based Apps and DevOps: Learnings from ...Business Continuity with Microservices-Based Apps and DevOps: Learnings from ...
Business Continuity with Microservices-Based Apps and DevOps: Learnings from ...DevOps.com
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulHostedbyConfluent
 
How to Autoscale in Apache Cloudstack using LiquiD AutoScaler
How to Autoscale in Apache Cloudstack using LiquiD AutoScalerHow to Autoscale in Apache Cloudstack using LiquiD AutoScaler
How to Autoscale in Apache Cloudstack using LiquiD AutoScalerBob Bennink
 
Tableapp architecture migration story for GCPUG.TW
Tableapp architecture migration story for GCPUG.TWTableapp architecture migration story for GCPUG.TW
Tableapp architecture migration story for GCPUG.TWYen-Wen Chen
 
Immutable infrastructure with Terraform
Immutable infrastructure with TerraformImmutable infrastructure with Terraform
Immutable infrastructure with TerraformPrashant Kalkar
 
Developing reliable applications with .net core and AKS
Developing reliable applications with .net core and AKSDeveloping reliable applications with .net core and AKS
Developing reliable applications with .net core and AKSAlessandro Melchiori
 
Persist your data in an ephemeral k8 ecosystem
Persist your data in an ephemeral k8 ecosystemPersist your data in an ephemeral k8 ecosystem
Persist your data in an ephemeral k8 ecosystemLibbySchulze
 
CEP Integration for Apache Stratos 4.0.0
CEP Integration for Apache Stratos 4.0.0CEP Integration for Apache Stratos 4.0.0
CEP Integration for Apache Stratos 4.0.0Manula Thantriwatte
 
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...Edureka!
 
Load Balancer Component Architecture - Apache Stratos 4.0.0
Load Balancer Component Architecture - Apache Stratos 4.0.0Load Balancer Component Architecture - Apache Stratos 4.0.0
Load Balancer Component Architecture - Apache Stratos 4.0.0Imesh Gunaratne
 
Intro to Helm for Kubernetes
Intro to Helm for KubernetesIntro to Helm for Kubernetes
Intro to Helm for KubernetesCarlos E. Salazar
 

What's hot (20)

CNCF Rajkot group- Know the magic of kubernetes with AWS EKS
CNCF Rajkot group- Know the magic of kubernetes with AWS EKSCNCF Rajkot group- Know the magic of kubernetes with AWS EKS
CNCF Rajkot group- Know the magic of kubernetes with AWS EKS
 
Helm chart-introduction
Helm chart-introductionHelm chart-introduction
Helm chart-introduction
 
[GS네오텍] Google Kubernetes Engine
[GS네오텍]  Google Kubernetes Engine [GS네오텍]  Google Kubernetes Engine
[GS네오텍] Google Kubernetes Engine
 
Scale your (aks) cluster, luke!
Scale your (aks) cluster, luke!Scale your (aks) cluster, luke!
Scale your (aks) cluster, luke!
 
From AWS to GCP, TABLEAPP Architecture Story
From AWS to GCP, TABLEAPP Architecture StoryFrom AWS to GCP, TABLEAPP Architecture Story
From AWS to GCP, TABLEAPP Architecture Story
 
Business Continuity with Microservices-Based Apps and DevOps: Learnings from ...
Business Continuity with Microservices-Based Apps and DevOps: Learnings from ...Business Continuity with Microservices-Based Apps and DevOps: Learnings from ...
Business Continuity with Microservices-Based Apps and DevOps: Learnings from ...
 
Dask for Analytics
Dask for AnalyticsDask for Analytics
Dask for Analytics
 
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, AzulBetter Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
 
How to Autoscale in Apache Cloudstack using LiquiD AutoScaler
How to Autoscale in Apache Cloudstack using LiquiD AutoScalerHow to Autoscale in Apache Cloudstack using LiquiD AutoScaler
How to Autoscale in Apache Cloudstack using LiquiD AutoScaler
 
Tableapp architecture migration story for GCPUG.TW
Tableapp architecture migration story for GCPUG.TWTableapp architecture migration story for GCPUG.TW
Tableapp architecture migration story for GCPUG.TW
 
Adam Hamsik - Kubernetes
Adam Hamsik - KubernetesAdam Hamsik - Kubernetes
Adam Hamsik - Kubernetes
 
Running Kubernetes
Running KubernetesRunning Kubernetes
Running Kubernetes
 
AWS ECS workshop
AWS ECS workshopAWS ECS workshop
AWS ECS workshop
 
Immutable infrastructure with Terraform
Immutable infrastructure with TerraformImmutable infrastructure with Terraform
Immutable infrastructure with Terraform
 
Developing reliable applications with .net core and AKS
Developing reliable applications with .net core and AKSDeveloping reliable applications with .net core and AKS
Developing reliable applications with .net core and AKS
 
Persist your data in an ephemeral k8 ecosystem
Persist your data in an ephemeral k8 ecosystemPersist your data in an ephemeral k8 ecosystem
Persist your data in an ephemeral k8 ecosystem
 
CEP Integration for Apache Stratos 4.0.0
CEP Integration for Apache Stratos 4.0.0CEP Integration for Apache Stratos 4.0.0
CEP Integration for Apache Stratos 4.0.0
 
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
 
Load Balancer Component Architecture - Apache Stratos 4.0.0
Load Balancer Component Architecture - Apache Stratos 4.0.0Load Balancer Component Architecture - Apache Stratos 4.0.0
Load Balancer Component Architecture - Apache Stratos 4.0.0
 
Intro to Helm for Kubernetes
Intro to Helm for KubernetesIntro to Helm for Kubernetes
Intro to Helm for Kubernetes
 

Similar to How we Auto Scale applications based on CPU with Kubernetes at M6Web?

Autoscaling in kubernetes v1
Autoscaling in kubernetes v1Autoscaling in kubernetes v1
Autoscaling in kubernetes v1JurajHantk
 
Adaptive Scaling of Microgateways on Kubernetes
Adaptive Scaling of Microgateways on KubernetesAdaptive Scaling of Microgateways on Kubernetes
Adaptive Scaling of Microgateways on KubernetesWSO2
 
Journey of Kubernetes Scaling
Journey of Kubernetes ScalingJourney of Kubernetes Scaling
Journey of Kubernetes ScalingOpsta
 
Kubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsKubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsDigitalOcean
 
Scaling Kubernetes to Support 50000 Services.pptx
Scaling Kubernetes to Support 50000 Services.pptxScaling Kubernetes to Support 50000 Services.pptx
Scaling Kubernetes to Support 50000 Services.pptxthaond2
 
Kubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical ViewKubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical ViewLei (Harry) Zhang
 
KubeCon Prometheus Salon -- Kubernetes metrics deep dive
KubeCon Prometheus Salon -- Kubernetes metrics deep diveKubeCon Prometheus Salon -- Kubernetes metrics deep dive
KubeCon Prometheus Salon -- Kubernetes metrics deep diveBob Cotton
 
QConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and Daemons
QConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and DaemonsQConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and Daemons
QConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and Daemonsaspyker
 
Kubermatic How to Migrate 100 Clusters from On-Prem to Google Cloud Without D...
Kubermatic How to Migrate 100 Clusters from On-Prem to Google Cloud Without D...Kubermatic How to Migrate 100 Clusters from On-Prem to Google Cloud Without D...
Kubermatic How to Migrate 100 Clusters from On-Prem to Google Cloud Without D...Tobias Schneck
 
How to Migrate 100 Clusters from On-Prem to Google Cloud Without Downtime
How to Migrate 100 Clusters from On-Prem to Google Cloud Without DowntimeHow to Migrate 100 Clusters from On-Prem to Google Cloud Without Downtime
How to Migrate 100 Clusters from On-Prem to Google Cloud Without Downtimeloodse
 
マイクロサービスと共に生きる!
マイクロサービスと共に生きる!マイクロサービスと共に生きる!
マイクロサービスと共に生きる!Tsukasa Kato
 
Managing Container Clusters in OpenStack Native Way
Managing Container Clusters in OpenStack Native WayManaging Container Clusters in OpenStack Native Way
Managing Container Clusters in OpenStack Native WayQiming Teng
 
Kubernetes basics, Nodes, Pods, Containers, Deployments
Kubernetes basics, Nodes, Pods, Containers, DeploymentsKubernetes basics, Nodes, Pods, Containers, Deployments
Kubernetes basics, Nodes, Pods, Containers, DeploymentsBeroza Paul
 
Kubernetes for Beginners
Kubernetes for BeginnersKubernetes for Beginners
Kubernetes for BeginnersDigitalOcean
 
20160503 Amazed by AWS | Tips about Performance on AWS
20160503 Amazed by AWS | Tips about Performance on AWS20160503 Amazed by AWS | Tips about Performance on AWS
20160503 Amazed by AWS | Tips about Performance on AWSAmazon Web Services Korea
 
(CMP402) Amazon EC2 Instances Deep Dive
(CMP402) Amazon EC2 Instances Deep Dive(CMP402) Amazon EC2 Instances Deep Dive
(CMP402) Amazon EC2 Instances Deep DiveAmazon Web Services
 

Similar to How we Auto Scale applications based on CPU with Kubernetes at M6Web? (20)

Autoscaling in kubernetes v1
Autoscaling in kubernetes v1Autoscaling in kubernetes v1
Autoscaling in kubernetes v1
 
Adaptive Scaling of Microgateways on Kubernetes
Adaptive Scaling of Microgateways on KubernetesAdaptive Scaling of Microgateways on Kubernetes
Adaptive Scaling of Microgateways on Kubernetes
 
Journey of Kubernetes Scaling
Journey of Kubernetes ScalingJourney of Kubernetes Scaling
Journey of Kubernetes Scaling
 
Kubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsKubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby Steps
 
Scaling Kubernetes to Support 50000 Services.pptx
Scaling Kubernetes to Support 50000 Services.pptxScaling Kubernetes to Support 50000 Services.pptx
Scaling Kubernetes to Support 50000 Services.pptx
 
Kubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical ViewKubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical View
 
Deep Dive Amazon EC2
Deep Dive Amazon EC2Deep Dive Amazon EC2
Deep Dive Amazon EC2
 
JFall 2018 k8s patterns
JFall 2018 k8s patternsJFall 2018 k8s patterns
JFall 2018 k8s patterns
 
KubeCon Prometheus Salon -- Kubernetes metrics deep dive
KubeCon Prometheus Salon -- Kubernetes metrics deep diveKubeCon Prometheus Salon -- Kubernetes metrics deep dive
KubeCon Prometheus Salon -- Kubernetes metrics deep dive
 
QConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and Daemons
QConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and DaemonsQConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and Daemons
QConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and Daemons
 
Kubermatic How to Migrate 100 Clusters from On-Prem to Google Cloud Without D...
Kubermatic How to Migrate 100 Clusters from On-Prem to Google Cloud Without D...Kubermatic How to Migrate 100 Clusters from On-Prem to Google Cloud Without D...
Kubermatic How to Migrate 100 Clusters from On-Prem to Google Cloud Without D...
 
How to Migrate 100 Clusters from On-Prem to Google Cloud Without Downtime
How to Migrate 100 Clusters from On-Prem to Google Cloud Without DowntimeHow to Migrate 100 Clusters from On-Prem to Google Cloud Without Downtime
How to Migrate 100 Clusters from On-Prem to Google Cloud Without Downtime
 
マイクロサービスと共に生きる!
マイクロサービスと共に生きる!マイクロサービスと共に生きる!
マイクロサービスと共に生きる!
 
Managing Container Clusters in OpenStack Native Way
Managing Container Clusters in OpenStack Native WayManaging Container Clusters in OpenStack Native Way
Managing Container Clusters in OpenStack Native Way
 
Scale Kubernetes to support 50000 services
Scale Kubernetes to support 50000 servicesScale Kubernetes to support 50000 services
Scale Kubernetes to support 50000 services
 
Kubernetes basics, Nodes, Pods, Containers, Deployments
Kubernetes basics, Nodes, Pods, Containers, DeploymentsKubernetes basics, Nodes, Pods, Containers, Deployments
Kubernetes basics, Nodes, Pods, Containers, Deployments
 
Introduction to Amazon EC2
Introduction to Amazon EC2Introduction to Amazon EC2
Introduction to Amazon EC2
 
Kubernetes for Beginners
Kubernetes for BeginnersKubernetes for Beginners
Kubernetes for Beginners
 
20160503 Amazed by AWS | Tips about Performance on AWS
20160503 Amazed by AWS | Tips about Performance on AWS20160503 Amazed by AWS | Tips about Performance on AWS
20160503 Amazed by AWS | Tips about Performance on AWS
 
(CMP402) Amazon EC2 Instances Deep Dive
(CMP402) Amazon EC2 Instances Deep Dive(CMP402) Amazon EC2 Instances Deep Dive
(CMP402) Amazon EC2 Instances Deep Dive
 

Recently uploaded

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsMonica Sydney
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...gajnagarg
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsPriya Reddy
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样ayvbos
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasDigicorns Technologies
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样ayvbos
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Roommeghakumariji156
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理F
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理F
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrHenryBriggs2
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.krishnachandrapal52
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...meghakumariji156
 

Recently uploaded (20)

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
 

How we Auto Scale applications based on CPU with Kubernetes at M6Web?

Editor's Notes

  1. We often talk about clouds and containers: The problem: make the apps of the devs work without overprovisioning servers. The cloud makes it possible to ensure that our invoice at the end of the month is consistent with the consumption of our data
  2. This is one of the objectives of k8s: Optimize resources Adapt the infra to the real use Keep applications healthy
  3. Kubernetes achieves these objectives in several ways
  4. Reminder about Kubernetes: I will present the objects used in this presentation
  5. A `pod` is the smallest unit you handle with Kubernetes. This is an instance of the application for Kubernetes. If you give a request to a pod, it knows how to answer it: it’s an autonomous instance of an app.
  6. A pod can be composed of several containers. To meet the load or improve availability, several replicas of the pod can be created.
  7. A `node` is a machine, often virtual, that is part of the cluster.
  8. A `cluster` groups all the machines with which Kubernetes works. A cluster is composed of master nodes where Kubernetes' internal functionalities run and worker nodes where your applications run.
  9. To adapt to the load, the number of pods of an application is changed. A `HorizontalPodAutoscaler` or HPA dynamically controls the number of replicas of a pod, often according to their CPU consumption. If our application consumes a lot: we add pods, if it consumes a little, we remove pods
  10. Here, we have increased the charge. Kubernetes noticed this, and therefore added pods to compensate for this additional load.
  11. A `service` exposes a pod on the network - whether it is the cluster's internal network or the Internet. It is a single entry point per application. We always have a single entry point: a service, that we have 30 pods spread over 23 nodes.
  12. It was quick, I take up these notions with an example
  13. The example is our geolocation API, which has been running in production for several months.
  14. The app geo is a POD composed of two containers, PHP and Nginx. A single pod is enough to respond to an HTTP request.
  15. We deployed this pod in a production cluster, so that it could be executed on a node.
  16. On the production cluster, composed of several worker nodes and several master nodes.
  17. We have defined 2 replicas minimum of our application, to secure its execution if one of the pods crashes. By deploying two replicas of our pod, Kubernetes scheduled them on nodes in its cluster.
  18. Depending on the load, the HPA will change the number of replicas of our geolocation application
  19. The geo application is accessed through a single entry point on the network: the service. The evolution of the number of pods is therefore transparent for customers, whether they have 2 pods or 23.
  20. And it's working pretty well!
  21. Here is an example with our last football game: We started the evening with our minimum of 2 pods and for the peak load of the evening, we climbed to 14 pods of the application.
  22. It's super cool, we autoscale our application depending on the load! And it's quite new for us sysadmins.
  23. It's beautiful, it sounds almost magical like that, but not at all.
  24. It's YAML and it's in the developers' repositories: you have your hands on it.
  25. There are 2 things to configure: 1) HPA -> The HPA here is configured on CPU consumption with a target at 80% of Container Requests
  26. 2) -> Requests Are reserved resources: Kubernetes will not launch the pod if these resources are not available in the cluster.
  27. To optimize its resources, Kubernetes needs to know the size of the apps: this is the purpose of Requests If k8s knows the size of the app, it runs it on the right server
  28. Requests are reserved resources. The app can consume more or less. Requests is the normal consumption of an app, it is the 100% use of the app in good conditions. However, the app must be able to handle more than 100%.
  29. So to be able to autoscale an app in k8s, you need these two elements.
  30. And it works very well! Here, we see with the use of the CPU in relation to the number of pods: the curves evolve in the same way.
  31. More precisely? Does the HPA makes an average, the median of the pods? The use of nodes?
  32. It is an average: It compares the average consumption of the pods with its target: the 80% of Requests.
  33. We're going back to the previous football game to see the evolution. Here, at 4:30 p. m., so before the game and the peak load.
  34. At 4:30pm, we had 2 pods, each consuming CPU resources. However, they consumed 70% of the requests, which is less than the HPA target. So there's no need to scramble.
  35. The same example at 6:30 p. m.: we consume more. We're past the target: there's a need for scale up.
  36. Resources are reserved according to demand When the consumption of our application approaches the target, we scale But not all peak loads are the same: how does HPA adapt?
  37. We saw it during our football walk: sometimes we scale 1 pod, sometimes 4 at a time. Of how much should the HPA scale?
  38. HPA follows a simple formula: He takes the number of pods, He looks at how much they consume resources compared to what we would like them to consume, The result is the number of pods that would have to rotate to respect this load.
  39. In our example of the soccer game at 6:30 p. m, We had 2 pods, which started consuming a lot of resources The result of the mathematical calculation is 3 pods. He added 1.
  40. Same example at 8:47 p.m. We used more resources, the HPA did its calculation, the result is 14 pods, we had 10, he added 4.
  41. That's how we scale our pods: kubernetes allows us this autoscaling quite simply, We know how to scroll until the cluster's resources are exhausted, It is driven by yaml, in the projects of the devs: on which they have the hand
  42. It's the CPU cores and so on, but how does a dev get autonomous on that?
  43. All the previous graphs come from our prod grafana with real prod metrics, accessible by devs.
  44. Example of a dashboard that shows CPU/RAM utilization of a pod
  45. It's yaml: it's easy to change and it's taken into account right away. And the previous values were changed after the football match, because they were not at all optimal
  46. 2 last points before closing the subject
  47. The cloud allows us to add more servers for a few hours. We use the cluster-autoscaler for this.
  48. HPA controllable by metrics. By default we use the CPU consumption, but the metrics can be custom as long as it is a metric that exists in Prometheus.
  49. You now know how application autoscaling works in kubernetes and you have the possibility to do it independently
  50. questions: Is it relevant to put high values on the requests? The value of the requests is taken into account for the triggering of the HPA. If the app consumes a lot of resources, then yes, If it consumes little, then autoscaling will be triggered late, or not at all (it will crash before) In all cases, the application must hold the load beyond the value of the requests: it can consume more Is it relevant to have a very high max HPA? Yes if the app can consume these resources under normal circumstances, On the other hand to have a max HPA at 1000 time the max value of the application has little interest It's more like a safeguard if you ever have a bug and you consume too much Custom Metrics are defined at the request level? No, Requests are the CPU and RAM, notions defined at the level of app containers. Metrics , custom or not, are used to define the HPA target: it is therefore defined at the HPA level What is the price of putting a very high max HPA? None: these requests are not reserved until the pods are launched So it doesn't cost anything, it's just protection What is the waiting time to launch an additional node? It depends on the cloud provider, At AWS, for the moment, it's between 3 and 5 minutes, So it's not instantaneous and it can be problematic in very high peak loads (we look at overprovisioning) What is the waiting time to scroll pods? A few seconds: we start new containers that are created very quickly We use docker containers for the moment, but Kubernetes is not restrictive to this. Can we scroll on a metric history? Not really. We scale according to a metric, on current values, The purpose of kubernetes is to have an infra that automatically scales according to the current load. Predicting a load is not part of its objectives. However, it is still something that can be done depending on the Prometheus request we make