SlideShare une entreprise Scribd logo
1  sur  70
Télécharger pour lire hors ligne
Automatically Scaling Your
Kubernetes Workloads
Automatically Scaling Your
Kubernetes Workloads
Sarah Schaab
Solutions Engineer
Datadog
Solutions Engineer
Former barber
Gleams the cube
@datadoghq
SaaS-based monitoring
250+ integrations
Trillions of data points per day
https://datadoghq.com
“I think there is a world market for maybe
five computers.”
– Thomas Watson, IBM
“I think there is a world market for maybe
five computers.”
– Thomas Watson, IBM, Wildly
misquoted
Why the HPA Is a Big Deal
Why the HPA Is a Big Deal
History of Kubernetes HPA
● K8S v1.2: autoscaling based off basic metrics within
cluster (e.g., CPU util.)
● K8S v1.6: autoscaling on custom metrics within
cluster
● K8S v1.10: autoscale based on ANY metric, including
external
History of Kubernetes HPA
● K8S v1.2: autoscaling based off basic metrics within
cluster (e.g. CPU util.)
● K8S v1.6: autoscaling on custom metrics within
cluster
● K8S v1.10: autoscale based on ANY metric, including
external
History of Kubernetes HPA
● K8S v1.2: autoscaling based off basic metrics within
cluster (e.g. CPU util.)
● K8S v1.6: autoscaling on custom metrics within
cluster
● K8S v1.10: autoscaling based on ANY metric,
including external
Choosing the
Autoscaling Metric
Recurse until you find the cause
Recurse until you find the cause
Implementing Autoscaling with a Custom
Metric
Implementing Autoscaling with a Custom
Metric
Prerequisites
❏ Kubernetes running v1.10 or higher
❏ Enable the aggregation layer: https://kubernetes.io/docs/tasks/access-
kubernetes-api/configure-aggregation-layer/
❏ Datadog account (free trials available)
❏ K8S nodes running Datadog Agent (ideally as a DaemonSet), with
Autodiscovery enabled
❏ Agents are configured to securely communicate with Cluster Agent (not
mandatory, but has more enriched data).
https://github.com/DataDog/datadog-agent/blob/master/Dockerfiles/cluster-
agent/README.md#security-premise
Spin up the Datadog Cluster Agent (RBAC)
kubectl apply -f manifests/cluster-agent/rbac/rbac-cluster-
agent.yaml
clusterrole.rbac.authorization.k8s.io "dca" created
clusterrolebinding.rbac.authorization.k8s.io "dca" created
serviceaccount "dca" created
Spin up the Datadog Cluster Agent (RBAC) Output
kubectl apply -f manifests/cluster-agent/rbac/rbac-cluster-
agent.yaml
clusterrole.rbac.authorization.k8s.io "dca" created
clusterrolebinding.rbac.authorization.k8s.io "dca" created
serviceaccount "dca" created
Create Datadog Cluster Agent & Services
In the Cluster Agent’s deployment manifest (cluster-agent.yaml)
add Datadog <API_KEY> and <APP_KEY>,
and set DD_EXTERNAL_METRICS_PROVIDER_ENABLED to true.
kubectl apply -f manifests/cluster-agent/cluster-agent.yaml
kubectl apply -f manifests/cluster-agent/datadog-cluster-
agent_service.yaml
kubectl apply -f manifests/cluster-agent/hpa-example/cluster-
agent-hpa-svc.yaml
Create Datadog Cluster Agent & Services
In the Cluster Agent’s deployment manifest (cluster-agent.yaml)
add Datadog <API_KEY> and <APP_KEY>,
and set DD_EXTERNAL_METRICS_PROVIDER_ENABLED to true.
kubectl apply -f manifests/cluster-agent/cluster-agent.yaml
kubectl apply -f manifests/cluster-agent/datadog-cluster-
agent_service.yaml
kubectl apply -f manifests/cluster-agent/hpa-example/cluster-
agent-hpa-svc.yaml
Create Datadog Cluster Agent & Services
In the Cluster Agent’s deployment manifest (cluster-agent.yaml)
add Datadog <API_KEY> and <APP_KEY>,
and set DD_EXTERNAL_METRICS_PROVIDER_ENABLED to true.
kubectl apply -f manifests/cluster-agent/cluster-agent.yaml
kubectl apply -f manifests/cluster-agent/datadog-cluster-
agent_service.yaml
kubectl apply -f manifests/cluster-agent/hpa-example/cluster-
agent-hpa-svc.yaml
Services in Kubernetes
Services == Load Balancer
Service == VIP
Verifying Cluster Agent
kubectl get pods, svc -l app=datadog-cluster-agent
PODS:
NAMESPACE NAME READY STATUS RESTARTS AGE
default datadog-cluster-agent-7b7f6d5547-cmdtc 1/1 Running 0 28m
SVCS:
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP
PORT(S) AGE
default datadog-custom-metrics-server ClusterIP 192.168.254.87 <none>
443/TCP 28m
default datadog-cluster-agent ClusterIP 192.168.254.197 <none>
5005/TCP 28m
Verifying Cluster Agent Output
kubectl get pods, svc -l app=datadog-cluster-agent
PODS:
NAMESPACE NAME READY STATUS RESTARTS AGE
default datadog-cluster-agent-7b7f6d5547-cmdtc 1/1 Running 0 28m
SVCS:
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP
PORT(S) AGE
default datadog-custom-metrics-server ClusterIP 192.168.254.87 <none>
443/TCP 28m
default datadog-cluster-agent ClusterIP 192.168.254.197 <none>
5005/TCP 28m
Register the External Metrics Provider
kubectl apply -f manifests/cluster-agent/hpa-example/rbac-hpa.yaml
clusterrolebinding.rbac.authorization.k8s.io "system:auth-delegator" created
rolebinding.rbac.authorization.k8s.io "dca" created
apiservice.apiregistration.k8s.io "v1beta1.external.metrics.k8s.io" created
clusterrole.rbac.authorization.k8s.io "external-metrics-reader" created
clusterrolebinding.rbac.authorization.k8s.io "external-metrics-reader" created
Register the External Metrics Provider Output
kubectl apply -f manifests/cluster-agent/hpa-example/rbac-hpa.yaml
clusterrolebinding.rbac.authorization.k8s.io "system:auth-delegator" created
rolebinding.rbac.authorization.k8s.io "dca" created
apiservice.apiregistration.k8s.io "v1beta1.external.metrics.k8s.io" created
clusterrole.rbac.authorization.k8s.io "external-metrics-reader" created
clusterrolebinding.rbac.authorization.k8s.io "external-metrics-reader" created
Datadog Cluster Agent Running
kubectl get pods,svc
PODS
NAMESPACE NAME READY STATUS RESTARTS AGE
default datadog-agent-4c5pp 1/1 Running 0 14m
default datadog-agent-ww2da 1/1 Running 0 14m
default datadog-agent-2qqd3 1/1 Running 0 14m
[...]
default datadog-cluster-agent-7b7f6d5547-cmdtc 1/1 Running 0 16m
Example HPA Manifest
● Is configured to scale a deployment called 'nginx'
● Set a maximum number of replicas to create to 3, with a minimum of 1
● HPA triggers autoscaling off of the Datadog metric
'nginx.net.request_per_sec' over the scope
'kube_container_name: nginx'
Example HPA Manifest
● Is configured to scale a deployment called 'nginx'
● Set a maximum number of replicas to create to 3, with a minimum of 1
● HPA triggers autoscaling off of the Datadog metric
'nginx.net.request_per_sec' over the scope
'kube_container_name: nginx'
Creating an Autoscaling Deployment
# Nginx deployment
kubectl apply -f manifests/cluster-agent/hpa-
example/nginx.yaml
# HPA manifest
kubectl apply -f manifests/cluster-agent/hpa-example/hpa-
manifest.yaml
# Verify
kubectl get pods,svc
Creating an Autoscaling Deployment
# Nginx deployment
kubectl apply -f manifests/cluster-agent/hpa-
example/nginx.yaml
# HPA manifest
kubectl apply -f manifests/cluster-agent/hpa-example/hpa-
manifest.yaml
# Verify
kubectl get pods,svc
Creating an Autoscaling Deployment
# Nginx deployment
kubectl apply -f manifests/cluster-agent/hpa-
example/nginx.yaml
# HPA manifest
kubectl apply -f manifests/cluster-agent/hpa-example/hpa-
manifest.yaml
# Verify
kubectl get pods,svc
POD:
default nginx-6757dd8769-5xzp2 1/1 Running 0 3m
SVC:
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default nginx ClusterIP 192.168.251.36 none 8090/TCP 3m
HPAS:
NAMESPACE NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS
AGE
default nginxext Deployment/nginx 0/9 (avg) 1 3 1
3m
curl <NGINX_SVC>:8090/nginx_status
while true; do curl <NGINX_SVC>:8090/nginx_status; sleep 0.1;
done
Let’s Stress it Out
+
+
kubectl get pods,svc
PODS:
NAMESPACE NAME READY STATUS RESTARTS AGE
default datadog-cluster-agent-7b7f6d5547-cmdtc 1/1 Running 0 9m
default nginx-6757dd8769-5xzp2 1/1 Running 0 2m
default nginx-6757dd8769-k6h6x 1/1 Running 0 2m
default nginx-6757dd8769-vzd5b 1/1 Running 0 29m
HPAS:
NAMESPACE NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
default nginxext Deployment/nginx 30/9 (avg) 1 3 3 29m
function yamllint() {
for i in $(find . -name '*.yml' -o -name '*.yaml');
do echo $i; ruby -e "require
'yaml';YAML.load_file("$i")"; done
}
In Conclusion
● Walked through a brief history of scaling and deploying
software
● Described some of the key components and history of the
HPA
● How to choose a metric on which to base autoscaling
● Think of autoscaling as an output for your monitoring
● Walkthrough implementing autoscaling with a custom
provider
● How a simple linting script can save you a lot of time,
effort, and embarrassment
In Conclusion
● Walked through a brief history of scaling and deploying
software
● Described some of the key components and history of the
HPA
● How to choose a metric on which to base autoscaling
● Think of autoscaling as an output for your monitoring
● Walkthrough implementing autoscaling with a custom
provider
● How a simple linting script can save you a lot of time,
effort, and embarrassment
Datadog Cluster Agent: https://github.com/DataDog/datadog-agent/tree/master/Dockerfiles/manifests/cluster-agent (includes an
example)
HPA blog: https://www.datadoghq.com/blog/autoscale-kubernetes-datadog/
DCA blog: https://www.datadoghq.com/blog/datadog-cluster-agent/
HPA Docs: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/
Enable the Kubernetes Aggregation Layer: https://kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/
Configure Agents to communicate securely with Cluster Agent: https://github.com/DataDog/datadog-
agent/blob/master/Dockerfiles/cluster-agent/README.md#security-premise
Datadog Cluster Agent Deployment Manifest: https://github.com/DataDog/datadog-agent/blob/master/Dockerfiles/manifests/cluster-
agent/cluster-agent.yaml
Datadog Example HPA: https://github.com/DataDog/datadog-agent/blob/master/Dockerfiles/manifests/cluster-agent/hpa-example/hpa-
manifest.yaml
Resources
Automatically Scaling Your
Kubernetes Workloads
Visit Our Booth

Contenu connexe

Tendances

AWS re:Invent 2016: From EC2 to ECS: How Capital One uses Application Load Ba...
AWS re:Invent 2016: From EC2 to ECS: How Capital One uses Application Load Ba...AWS re:Invent 2016: From EC2 to ECS: How Capital One uses Application Load Ba...
AWS re:Invent 2016: From EC2 to ECS: How Capital One uses Application Load Ba...Amazon Web Services
 
使用 Blox 實現容器任務調度與資源編排
使用 Blox 實現容器任務調度與資源編排使用 Blox 實現容器任務調度與資源編排
使用 Blox 實現容器任務調度與資源編排Amazon Web Services
 
Introduction to Google Cloud Platform
Introduction to Google Cloud PlatformIntroduction to Google Cloud Platform
Introduction to Google Cloud PlatformOpsta
 
Batch Processing with Amazon EC2 Container Service
Batch Processing with Amazon EC2 Container ServiceBatch Processing with Amazon EC2 Container Service
Batch Processing with Amazon EC2 Container ServiceAmazon Web Services
 
#lspe Q1 2013 dynamically scaling netflix in the cloud
#lspe Q1 2013   dynamically scaling netflix in the cloud#lspe Q1 2013   dynamically scaling netflix in the cloud
#lspe Q1 2013 dynamically scaling netflix in the cloudCoburn Watson
 
Riga DevDays 2017 - Efficient AWS Lambda
Riga DevDays 2017 - Efficient AWS LambdaRiga DevDays 2017 - Efficient AWS Lambda
Riga DevDays 2017 - Efficient AWS LambdaAntons Kranga
 
AWS re:Invent 2016: Get Technically Inspired by Container-Powered Migrations ...
AWS re:Invent 2016: Get Technically Inspired by Container-Powered Migrations ...AWS re:Invent 2016: Get Technically Inspired by Container-Powered Migrations ...
AWS re:Invent 2016: Get Technically Inspired by Container-Powered Migrations ...Amazon Web Services
 
Deep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSDeep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSAmazon Web Services
 
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...Amazon Web Services
 
Using AWS CloudWatch Custom Metrics and EC2 Auto Scaling -VSocial Infrastructure
Using AWS CloudWatch Custom Metrics and EC2 Auto Scaling -VSocial InfrastructureUsing AWS CloudWatch Custom Metrics and EC2 Auto Scaling -VSocial Infrastructure
Using AWS CloudWatch Custom Metrics and EC2 Auto Scaling -VSocial InfrastructureChristopher Drumgoole
 
AWS re:Invent 2016 Recap: What Happened, What It Means
AWS re:Invent 2016 Recap: What Happened, What It MeansAWS re:Invent 2016 Recap: What Happened, What It Means
AWS re:Invent 2016 Recap: What Happened, What It MeansRightScale
 
Deep Dive on Elastic Load Balancing
Deep Dive on Elastic Load BalancingDeep Dive on Elastic Load Balancing
Deep Dive on Elastic Load BalancingAmazon Web Services
 
Google App Engine (GAE) 演進史
Google App Engine (GAE) 演進史Google App Engine (GAE) 演進史
Google App Engine (GAE) 演進史Simon Su
 
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSServerless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSCodeOps Technologies LLP
 
AWS re:Invent 2016: NEW LAUNCH! Lambda Everywhere (IOT309)
AWS re:Invent 2016: NEW LAUNCH! Lambda Everywhere (IOT309)AWS re:Invent 2016: NEW LAUNCH! Lambda Everywhere (IOT309)
AWS re:Invent 2016: NEW LAUNCH! Lambda Everywhere (IOT309)Amazon Web Services
 
Google App Engine/ Java Application Development
Google App Engine/ Java Application DevelopmentGoogle App Engine/ Java Application Development
Google App Engine/ Java Application DevelopmentShuji Watanabe
 
AWSの進化とSmartNewsの裏側
AWSの進化とSmartNewsの裏側AWSの進化とSmartNewsの裏側
AWSの進化とSmartNewsの裏側SmartNews, Inc.
 
Machine learning in the physical world by Kip Larson from AWS IoT
Machine learning in the physical world by  Kip Larson from AWS IoTMachine learning in the physical world by  Kip Larson from AWS IoT
Machine learning in the physical world by Kip Larson from AWS IoTBill Liu
 

Tendances (20)

AWS re:Invent 2016: From EC2 to ECS: How Capital One uses Application Load Ba...
AWS re:Invent 2016: From EC2 to ECS: How Capital One uses Application Load Ba...AWS re:Invent 2016: From EC2 to ECS: How Capital One uses Application Load Ba...
AWS re:Invent 2016: From EC2 to ECS: How Capital One uses Application Load Ba...
 
使用 Blox 實現容器任務調度與資源編排
使用 Blox 實現容器任務調度與資源編排使用 Blox 實現容器任務調度與資源編排
使用 Blox 實現容器任務調度與資源編排
 
Introduction to Google Cloud Platform
Introduction to Google Cloud PlatformIntroduction to Google Cloud Platform
Introduction to Google Cloud Platform
 
Batch Processing with Amazon EC2 Container Service
Batch Processing with Amazon EC2 Container ServiceBatch Processing with Amazon EC2 Container Service
Batch Processing with Amazon EC2 Container Service
 
#lspe Q1 2013 dynamically scaling netflix in the cloud
#lspe Q1 2013   dynamically scaling netflix in the cloud#lspe Q1 2013   dynamically scaling netflix in the cloud
#lspe Q1 2013 dynamically scaling netflix in the cloud
 
Riga DevDays 2017 - Efficient AWS Lambda
Riga DevDays 2017 - Efficient AWS LambdaRiga DevDays 2017 - Efficient AWS Lambda
Riga DevDays 2017 - Efficient AWS Lambda
 
AWS re:Invent 2016: Get Technically Inspired by Container-Powered Migrations ...
AWS re:Invent 2016: Get Technically Inspired by Container-Powered Migrations ...AWS re:Invent 2016: Get Technically Inspired by Container-Powered Migrations ...
AWS re:Invent 2016: Get Technically Inspired by Container-Powered Migrations ...
 
Deep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSDeep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECS
 
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
Announcing AWS Batch - Run Batch Jobs At Scale - December 2016 Monthly Webina...
 
Using AWS CloudWatch Custom Metrics and EC2 Auto Scaling -VSocial Infrastructure
Using AWS CloudWatch Custom Metrics and EC2 Auto Scaling -VSocial InfrastructureUsing AWS CloudWatch Custom Metrics and EC2 Auto Scaling -VSocial Infrastructure
Using AWS CloudWatch Custom Metrics and EC2 Auto Scaling -VSocial Infrastructure
 
AWS re:Invent 2016 Recap: What Happened, What It Means
AWS re:Invent 2016 Recap: What Happened, What It MeansAWS re:Invent 2016 Recap: What Happened, What It Means
AWS re:Invent 2016 Recap: What Happened, What It Means
 
Deep Dive on Elastic Load Balancing
Deep Dive on Elastic Load BalancingDeep Dive on Elastic Load Balancing
Deep Dive on Elastic Load Balancing
 
Auto Retweets Using AWS Lambda
Auto Retweets Using AWS LambdaAuto Retweets Using AWS Lambda
Auto Retweets Using AWS Lambda
 
Google App Engine (GAE) 演進史
Google App Engine (GAE) 演進史Google App Engine (GAE) 演進史
Google App Engine (GAE) 演進史
 
Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)
 
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSServerless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
 
AWS re:Invent 2016: NEW LAUNCH! Lambda Everywhere (IOT309)
AWS re:Invent 2016: NEW LAUNCH! Lambda Everywhere (IOT309)AWS re:Invent 2016: NEW LAUNCH! Lambda Everywhere (IOT309)
AWS re:Invent 2016: NEW LAUNCH! Lambda Everywhere (IOT309)
 
Google App Engine/ Java Application Development
Google App Engine/ Java Application DevelopmentGoogle App Engine/ Java Application Development
Google App Engine/ Java Application Development
 
AWSの進化とSmartNewsの裏側
AWSの進化とSmartNewsの裏側AWSの進化とSmartNewsの裏側
AWSの進化とSmartNewsの裏側
 
Machine learning in the physical world by Kip Larson from AWS IoT
Machine learning in the physical world by  Kip Larson from AWS IoTMachine learning in the physical world by  Kip Larson from AWS IoT
Machine learning in the physical world by Kip Larson from AWS IoT
 

Similaire à Automatically scaling your Kubernetes workloads - SVC201-S - Chicago AWS Summit

Autoscaling Your Kubernetes Workloads (Sponsored by Datadog) - AWS Summit Sydney
Autoscaling Your Kubernetes Workloads (Sponsored by Datadog) - AWS Summit SydneyAutoscaling Your Kubernetes Workloads (Sponsored by Datadog) - AWS Summit Sydney
Autoscaling Your Kubernetes Workloads (Sponsored by Datadog) - AWS Summit SydneyAmazon Web Services
 
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS SummitAutomatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS SummitAmazon Web Services
 
Automatically scaling your Kubernetes workloads - SVC210-S - Santa Clara AWS ...
Automatically scaling your Kubernetes workloads - SVC210-S - Santa Clara AWS ...Automatically scaling your Kubernetes workloads - SVC210-S - Santa Clara AWS ...
Automatically scaling your Kubernetes workloads - SVC210-S - Santa Clara AWS ...Amazon Web Services
 
AWS Summit Singapore 2019 | Autoscaling Your Kubernetes Workloads
AWS Summit Singapore 2019 | Autoscaling Your Kubernetes WorkloadsAWS Summit Singapore 2019 | Autoscaling Your Kubernetes Workloads
AWS Summit Singapore 2019 | Autoscaling Your Kubernetes WorkloadsAWS Summits
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationSean Chittenden
 
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...Geir Høydalsvik
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesDataWorks Summit
 
Splunk: Druid on Kubernetes with Druid-operator
Splunk: Druid on Kubernetes with Druid-operatorSplunk: Druid on Kubernetes with Druid-operator
Splunk: Druid on Kubernetes with Druid-operatorImply
 
Openshift operator insight
Openshift operator insightOpenshift operator insight
Openshift operator insightRyan ZhangCheng
 
Dok Talks #124 - Intro to Druid on Kubernetes
Dok Talks #124 - Intro to Druid on KubernetesDok Talks #124 - Intro to Druid on Kubernetes
Dok Talks #124 - Intro to Druid on KubernetesDoKC
 
Running MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on KubernetesRunning MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on KubernetesAriel Jatib
 
Query Your Streaming Data on Kafka using SQL: Why, How, and What
Query Your Streaming Data on Kafka using SQL: Why, How, and WhatQuery Your Streaming Data on Kafka using SQL: Why, How, and What
Query Your Streaming Data on Kafka using SQL: Why, How, and WhatHostedbyConfluent
 
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on OpenstackLinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on OpenstackOpenShift Origin
 
KSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for KafkaKSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for Kafkaconfluent
 
PaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at YelpPaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at YelpNathan Handler
 
Event-driven automation, DevOps way ~IoT時代の自動化、そのリアリティとは?~
Event-driven automation, DevOps way ~IoT時代の自動化、そのリアリティとは?~Event-driven automation, DevOps way ~IoT時代の自動化、そのリアリティとは?~
Event-driven automation, DevOps way ~IoT時代の自動化、そのリアリティとは?~Brocade
 
Super-NetOps Source of Truth
Super-NetOps Source of TruthSuper-NetOps Source of Truth
Super-NetOps Source of TruthJoel W. King
 
ACDKOCHI19 - Turbocharge Developer productivity with platform build on K8S an...
ACDKOCHI19 - Turbocharge Developer productivity with platform build on K8S an...ACDKOCHI19 - Turbocharge Developer productivity with platform build on K8S an...
ACDKOCHI19 - Turbocharge Developer productivity with platform build on K8S an...AWS User Group Kochi
 
Free & Open DynamoDB API for Everyone
Free & Open DynamoDB API for EveryoneFree & Open DynamoDB API for Everyone
Free & Open DynamoDB API for EveryoneScyllaDB
 

Similaire à Automatically scaling your Kubernetes workloads - SVC201-S - Chicago AWS Summit (20)

Autoscaling Your Kubernetes Workloads (Sponsored by Datadog) - AWS Summit Sydney
Autoscaling Your Kubernetes Workloads (Sponsored by Datadog) - AWS Summit SydneyAutoscaling Your Kubernetes Workloads (Sponsored by Datadog) - AWS Summit Sydney
Autoscaling Your Kubernetes Workloads (Sponsored by Datadog) - AWS Summit Sydney
 
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS SummitAutomatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
Automatically Scaling Your Kubernetes Workloads - SVC209-S - Anaheim AWS Summit
 
Automatically scaling your Kubernetes workloads - SVC210-S - Santa Clara AWS ...
Automatically scaling your Kubernetes workloads - SVC210-S - Santa Clara AWS ...Automatically scaling your Kubernetes workloads - SVC210-S - Santa Clara AWS ...
Automatically scaling your Kubernetes workloads - SVC210-S - Santa Clara AWS ...
 
AWS Summit Singapore 2019 | Autoscaling Your Kubernetes Workloads
AWS Summit Singapore 2019 | Autoscaling Your Kubernetes WorkloadsAWS Summit Singapore 2019 | Autoscaling Your Kubernetes Workloads
AWS Summit Singapore 2019 | Autoscaling Your Kubernetes Workloads
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern Automation
 
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
 
Splunk: Druid on Kubernetes with Druid-operator
Splunk: Druid on Kubernetes with Druid-operatorSplunk: Druid on Kubernetes with Druid-operator
Splunk: Druid on Kubernetes with Druid-operator
 
Openshift operator insight
Openshift operator insightOpenshift operator insight
Openshift operator insight
 
Dok Talks #124 - Intro to Druid on Kubernetes
Dok Talks #124 - Intro to Druid on KubernetesDok Talks #124 - Intro to Druid on Kubernetes
Dok Talks #124 - Intro to Druid on Kubernetes
 
Running MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on KubernetesRunning MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on Kubernetes
 
Query Your Streaming Data on Kafka using SQL: Why, How, and What
Query Your Streaming Data on Kafka using SQL: Why, How, and WhatQuery Your Streaming Data on Kafka using SQL: Why, How, and What
Query Your Streaming Data on Kafka using SQL: Why, How, and What
 
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on OpenstackLinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
 
KSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for KafkaKSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for Kafka
 
PaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at YelpPaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at Yelp
 
Event-driven automation, DevOps way ~IoT時代の自動化、そのリアリティとは?~
Event-driven automation, DevOps way ~IoT時代の自動化、そのリアリティとは?~Event-driven automation, DevOps way ~IoT時代の自動化、そのリアリティとは?~
Event-driven automation, DevOps way ~IoT時代の自動化、そのリアリティとは?~
 
MySQL on Docker and Kubernetes
MySQL on Docker and KubernetesMySQL on Docker and Kubernetes
MySQL on Docker and Kubernetes
 
Super-NetOps Source of Truth
Super-NetOps Source of TruthSuper-NetOps Source of Truth
Super-NetOps Source of Truth
 
ACDKOCHI19 - Turbocharge Developer productivity with platform build on K8S an...
ACDKOCHI19 - Turbocharge Developer productivity with platform build on K8S an...ACDKOCHI19 - Turbocharge Developer productivity with platform build on K8S an...
ACDKOCHI19 - Turbocharge Developer productivity with platform build on K8S an...
 
Free & Open DynamoDB API for Everyone
Free & Open DynamoDB API for EveryoneFree & Open DynamoDB API for Everyone
Free & Open DynamoDB API for Everyone
 

Plus de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Automatically scaling your Kubernetes workloads - SVC201-S - Chicago AWS Summit

  • 2. Automatically Scaling Your Kubernetes Workloads Sarah Schaab Solutions Engineer Datadog
  • 4. @datadoghq SaaS-based monitoring 250+ integrations Trillions of data points per day https://datadoghq.com
  • 5. “I think there is a world market for maybe five computers.” – Thomas Watson, IBM
  • 6. “I think there is a world market for maybe five computers.” – Thomas Watson, IBM, Wildly misquoted
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Why the HPA Is a Big Deal
  • 22. Why the HPA Is a Big Deal
  • 23. History of Kubernetes HPA ● K8S v1.2: autoscaling based off basic metrics within cluster (e.g., CPU util.) ● K8S v1.6: autoscaling on custom metrics within cluster ● K8S v1.10: autoscale based on ANY metric, including external
  • 24. History of Kubernetes HPA ● K8S v1.2: autoscaling based off basic metrics within cluster (e.g. CPU util.) ● K8S v1.6: autoscaling on custom metrics within cluster ● K8S v1.10: autoscale based on ANY metric, including external
  • 25. History of Kubernetes HPA ● K8S v1.2: autoscaling based off basic metrics within cluster (e.g. CPU util.) ● K8S v1.6: autoscaling on custom metrics within cluster ● K8S v1.10: autoscaling based on ANY metric, including external
  • 27.
  • 28. Recurse until you find the cause
  • 29. Recurse until you find the cause
  • 30.
  • 31.
  • 32.
  • 33.
  • 34. Implementing Autoscaling with a Custom Metric
  • 35. Implementing Autoscaling with a Custom Metric
  • 36.
  • 37. Prerequisites ❏ Kubernetes running v1.10 or higher ❏ Enable the aggregation layer: https://kubernetes.io/docs/tasks/access- kubernetes-api/configure-aggregation-layer/ ❏ Datadog account (free trials available) ❏ K8S nodes running Datadog Agent (ideally as a DaemonSet), with Autodiscovery enabled ❏ Agents are configured to securely communicate with Cluster Agent (not mandatory, but has more enriched data). https://github.com/DataDog/datadog-agent/blob/master/Dockerfiles/cluster- agent/README.md#security-premise
  • 38. Spin up the Datadog Cluster Agent (RBAC) kubectl apply -f manifests/cluster-agent/rbac/rbac-cluster- agent.yaml clusterrole.rbac.authorization.k8s.io "dca" created clusterrolebinding.rbac.authorization.k8s.io "dca" created serviceaccount "dca" created
  • 39. Spin up the Datadog Cluster Agent (RBAC) Output kubectl apply -f manifests/cluster-agent/rbac/rbac-cluster- agent.yaml clusterrole.rbac.authorization.k8s.io "dca" created clusterrolebinding.rbac.authorization.k8s.io "dca" created serviceaccount "dca" created
  • 40. Create Datadog Cluster Agent & Services In the Cluster Agent’s deployment manifest (cluster-agent.yaml) add Datadog <API_KEY> and <APP_KEY>, and set DD_EXTERNAL_METRICS_PROVIDER_ENABLED to true. kubectl apply -f manifests/cluster-agent/cluster-agent.yaml kubectl apply -f manifests/cluster-agent/datadog-cluster- agent_service.yaml kubectl apply -f manifests/cluster-agent/hpa-example/cluster- agent-hpa-svc.yaml
  • 41.
  • 42. Create Datadog Cluster Agent & Services In the Cluster Agent’s deployment manifest (cluster-agent.yaml) add Datadog <API_KEY> and <APP_KEY>, and set DD_EXTERNAL_METRICS_PROVIDER_ENABLED to true. kubectl apply -f manifests/cluster-agent/cluster-agent.yaml kubectl apply -f manifests/cluster-agent/datadog-cluster- agent_service.yaml kubectl apply -f manifests/cluster-agent/hpa-example/cluster- agent-hpa-svc.yaml
  • 43. Create Datadog Cluster Agent & Services In the Cluster Agent’s deployment manifest (cluster-agent.yaml) add Datadog <API_KEY> and <APP_KEY>, and set DD_EXTERNAL_METRICS_PROVIDER_ENABLED to true. kubectl apply -f manifests/cluster-agent/cluster-agent.yaml kubectl apply -f manifests/cluster-agent/datadog-cluster- agent_service.yaml kubectl apply -f manifests/cluster-agent/hpa-example/cluster- agent-hpa-svc.yaml
  • 44. Services in Kubernetes Services == Load Balancer Service == VIP
  • 45. Verifying Cluster Agent kubectl get pods, svc -l app=datadog-cluster-agent PODS: NAMESPACE NAME READY STATUS RESTARTS AGE default datadog-cluster-agent-7b7f6d5547-cmdtc 1/1 Running 0 28m SVCS: NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE default datadog-custom-metrics-server ClusterIP 192.168.254.87 <none> 443/TCP 28m default datadog-cluster-agent ClusterIP 192.168.254.197 <none> 5005/TCP 28m
  • 46. Verifying Cluster Agent Output kubectl get pods, svc -l app=datadog-cluster-agent PODS: NAMESPACE NAME READY STATUS RESTARTS AGE default datadog-cluster-agent-7b7f6d5547-cmdtc 1/1 Running 0 28m SVCS: NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE default datadog-custom-metrics-server ClusterIP 192.168.254.87 <none> 443/TCP 28m default datadog-cluster-agent ClusterIP 192.168.254.197 <none> 5005/TCP 28m
  • 47. Register the External Metrics Provider kubectl apply -f manifests/cluster-agent/hpa-example/rbac-hpa.yaml clusterrolebinding.rbac.authorization.k8s.io "system:auth-delegator" created rolebinding.rbac.authorization.k8s.io "dca" created apiservice.apiregistration.k8s.io "v1beta1.external.metrics.k8s.io" created clusterrole.rbac.authorization.k8s.io "external-metrics-reader" created clusterrolebinding.rbac.authorization.k8s.io "external-metrics-reader" created
  • 48. Register the External Metrics Provider Output kubectl apply -f manifests/cluster-agent/hpa-example/rbac-hpa.yaml clusterrolebinding.rbac.authorization.k8s.io "system:auth-delegator" created rolebinding.rbac.authorization.k8s.io "dca" created apiservice.apiregistration.k8s.io "v1beta1.external.metrics.k8s.io" created clusterrole.rbac.authorization.k8s.io "external-metrics-reader" created clusterrolebinding.rbac.authorization.k8s.io "external-metrics-reader" created
  • 49. Datadog Cluster Agent Running kubectl get pods,svc PODS NAMESPACE NAME READY STATUS RESTARTS AGE default datadog-agent-4c5pp 1/1 Running 0 14m default datadog-agent-ww2da 1/1 Running 0 14m default datadog-agent-2qqd3 1/1 Running 0 14m [...] default datadog-cluster-agent-7b7f6d5547-cmdtc 1/1 Running 0 16m
  • 50. Example HPA Manifest ● Is configured to scale a deployment called 'nginx' ● Set a maximum number of replicas to create to 3, with a minimum of 1 ● HPA triggers autoscaling off of the Datadog metric 'nginx.net.request_per_sec' over the scope 'kube_container_name: nginx'
  • 51. Example HPA Manifest ● Is configured to scale a deployment called 'nginx' ● Set a maximum number of replicas to create to 3, with a minimum of 1 ● HPA triggers autoscaling off of the Datadog metric 'nginx.net.request_per_sec' over the scope 'kube_container_name: nginx'
  • 52.
  • 53.
  • 54. Creating an Autoscaling Deployment # Nginx deployment kubectl apply -f manifests/cluster-agent/hpa- example/nginx.yaml # HPA manifest kubectl apply -f manifests/cluster-agent/hpa-example/hpa- manifest.yaml # Verify kubectl get pods,svc
  • 55.
  • 56. Creating an Autoscaling Deployment # Nginx deployment kubectl apply -f manifests/cluster-agent/hpa- example/nginx.yaml # HPA manifest kubectl apply -f manifests/cluster-agent/hpa-example/hpa- manifest.yaml # Verify kubectl get pods,svc
  • 57. Creating an Autoscaling Deployment # Nginx deployment kubectl apply -f manifests/cluster-agent/hpa- example/nginx.yaml # HPA manifest kubectl apply -f manifests/cluster-agent/hpa-example/hpa- manifest.yaml # Verify kubectl get pods,svc
  • 58. POD: default nginx-6757dd8769-5xzp2 1/1 Running 0 3m SVC: NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE default nginx ClusterIP 192.168.251.36 none 8090/TCP 3m HPAS: NAMESPACE NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE default nginxext Deployment/nginx 0/9 (avg) 1 3 1 3m
  • 59. curl <NGINX_SVC>:8090/nginx_status while true; do curl <NGINX_SVC>:8090/nginx_status; sleep 0.1; done Let’s Stress it Out
  • 60. +
  • 61. +
  • 62. kubectl get pods,svc PODS: NAMESPACE NAME READY STATUS RESTARTS AGE default datadog-cluster-agent-7b7f6d5547-cmdtc 1/1 Running 0 9m default nginx-6757dd8769-5xzp2 1/1 Running 0 2m default nginx-6757dd8769-k6h6x 1/1 Running 0 2m default nginx-6757dd8769-vzd5b 1/1 Running 0 29m HPAS: NAMESPACE NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE default nginxext Deployment/nginx 30/9 (avg) 1 3 3 29m
  • 63.
  • 64.
  • 65. function yamllint() { for i in $(find . -name '*.yml' -o -name '*.yaml'); do echo $i; ruby -e "require 'yaml';YAML.load_file("$i")"; done }
  • 66. In Conclusion ● Walked through a brief history of scaling and deploying software ● Described some of the key components and history of the HPA ● How to choose a metric on which to base autoscaling ● Think of autoscaling as an output for your monitoring ● Walkthrough implementing autoscaling with a custom provider ● How a simple linting script can save you a lot of time, effort, and embarrassment
  • 67. In Conclusion ● Walked through a brief history of scaling and deploying software ● Described some of the key components and history of the HPA ● How to choose a metric on which to base autoscaling ● Think of autoscaling as an output for your monitoring ● Walkthrough implementing autoscaling with a custom provider ● How a simple linting script can save you a lot of time, effort, and embarrassment
  • 68. Datadog Cluster Agent: https://github.com/DataDog/datadog-agent/tree/master/Dockerfiles/manifests/cluster-agent (includes an example) HPA blog: https://www.datadoghq.com/blog/autoscale-kubernetes-datadog/ DCA blog: https://www.datadoghq.com/blog/datadog-cluster-agent/ HPA Docs: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/ Enable the Kubernetes Aggregation Layer: https://kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/ Configure Agents to communicate securely with Cluster Agent: https://github.com/DataDog/datadog- agent/blob/master/Dockerfiles/cluster-agent/README.md#security-premise Datadog Cluster Agent Deployment Manifest: https://github.com/DataDog/datadog-agent/blob/master/Dockerfiles/manifests/cluster- agent/cluster-agent.yaml Datadog Example HPA: https://github.com/DataDog/datadog-agent/blob/master/Dockerfiles/manifests/cluster-agent/hpa-example/hpa- manifest.yaml Resources