Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Cluster Autoscaler: Dynamic & Automatic Reconfi...
Search
KUOKA Yusuke
August 08, 2017
Technology
2
270
Cluster Autoscaler: Dynamic & Automatic Reconfiguration
Presented at Kubernetes Meetup Tokyo #6:
https://k8sjp.connpass.com/event/60324/
KUOKA Yusuke
August 08, 2017
Tweet
Share
More Decks by KUOKA Yusuke
See All by KUOKA Yusuke
Helmfile: Supercharge your deployment pipeline
mumoshu
4
2k
Migrating to EKS
mumoshu
0
440
Kubernetes on AWS/EKSベストプラクティス2019.2 #jawsdays
mumoshu
34
16k
[5 min. LT] Kubernetes on AWS after EKS & Recommendations on production EKS clusters
mumoshu
4
6.5k
Zero to Anomaly Detection with Kubeflow
mumoshu
1
2.2k
Programming on Kubernetes - Do More With Less
mumoshu
6
1.1k
Sustainable Kubernetes
mumoshu
16
4.2k
Kubernetesへのデプロイメント 〜進化の過程と展望〜 後半パート
mumoshu
2
9.1k
Helmfile - A declarative way to deploy Helm charts -
mumoshu
5
9.6k
Other Decks in Technology
See All in Technology
スクラムチームを立ち上げる〜チーム開発で得られたもの・得られなかったもの〜
ohnoeight
2
350
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
12k
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
Terraform Stacks入門 #HashiTalks
msato
0
350
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
250
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
SSMRunbook作成の勘所_20241120
koichiotomo
2
130
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
The Rise of LLMOps
asei
7
1.4k
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
73
9.1k
Teambox: Starting and Learning
jrom
133
8.8k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Producing Creativity
orderedlist
PRO
341
39k
Building Your Own Lightsaber
phodgson
103
6.1k
Transcript
Cluster Autoscaler Dynamic & Automatic Reconfiguration @mumoshu, primary maintainer of
kube-aws/contributor of cluster- autoscaler Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 1
Կͷ • K8S on AWSͰΦʔτεέʔϦϯάΛ͢Δ • pod͡Όͳͯ͘nodeͷ΄͏ • cluster-autoscaler(CA)Λ͏ Kubernetes
Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 2
Cluster Autoscaler: FAQ • ΫϥυϓϩόΠμඪ४ͷΦʔτεέʔϦϯάͱͷҧ͍? • AWS AutoScaling: based on
CPU/RequestCount(ALB) • Cluster Autoscaler: Autoscaling based on total resource requests • e.g. add node(s) when CA sees pending pods • Pod࡞Γ͗ͯᷓ͢ΕͨΒϊʔυ૿͢Α! Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 3
Why: I was too lazy to operate CA • K8SΫϥελͷӡ༻ΔιϑτΣΞΤϯδχΞ
• Φʔτεέʔϧར༻͍ͨ͠ • CAͷӡ༻͕ຯʹΊΜͲ͍͘͞ I'm responsible to run several production K8S clusters on AWS. I'd like to enable autoscaling on them but I'm too lazy to operate CA. I'm basically a software who loves sketching & coding, not operating ! Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 4
Why: Syncing node pool config between cloud<->CA • ASG on
AWSͱCA on K8Sͷઃఆผ • Cloud Provider: Node Pool Min/Max Size • CA: Node Pool Min/Max Size • Change(s) on AWS-side requires updating/restarting CA • ໃ६͕͋Δͱਖ਼͘͠ಈ͔ͳ͍ • AWSଆͰઃఆΛม͑ͨΒɺCAͷઃఆΛม͑ͯ࠶ىಈ͕ඞཁ Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 5
Node Pools/ϊʔυϓʔϧ • AutoScaling Group(AWS) aws autoscaling update-auto-scaling-group \ --auto-scaling-group-name
$NAME \ --min-size $MIN \ --max-size $MAX • Instance Group in GCE? Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 6
CA 1. kubectl edit deployment cluster-autoscaler 2. cluster-autoscaler --nodes $MIN:$MAX:$NAME
Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 7
2खؒ • ࡞ۀΕͦ͠͏ • Scripting? • ͜Ε͚ͩͷͨΊʹ…? Kubernetes Meetup Tokyo
#6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 8
ASGͱCAͷઃఆ • Ͳ͕ͬͪਖ਼ͳͷ? • ASGͷ߹ • CAͷmin >= ASGͷmin •
CAͷmax <= ASGͷmax Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 9
How • ASGͷઃఆΛCA͕ࣗಈతʹಡΜͰ͘ΕΕΑ͘ͳ͍? Shouldn't CA automatically sync up with AWS
about ASGs it is told to manage? Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 10
What • CAͷ৽ػೳ 1. Dynamic Reconfiguration 2. Node Group Automatic
Discovery ! Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 11
Dynamic Reconfiguration • CAͷઃఆΛConfigMapʹॻ͘ • ConfigMapΛॻ͖͑ΔͱCA͕ࣗಈϦϩʔυ(--configmap) • PR: github.com/kubernetes/contrib/pull/2226 Kubernetes
Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 12
Dynamic Reconfigurationͷར༻ํ๏ kubectl create configmap cluster-autoscaler -f ca-config.yaml Kubernetes Meetup
Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 13
kind: ConfigMap apiVersion: v1 metadata: name: cluster-autoscaler namespace: kube-system data:
settings: |- { "nodeGroups": [ { "minSize": 1, "maxSize": 2, "name": "myasg" } ] } Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 14
./cluster-autoscaler --configmap=cluster-autoscaler ... Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic
& Automatic Reconfiguration © 2017 mumoshu 15
όʔδϣϯ • CA 0.5.2͔Β Kubernetes Meetup Tokyo #6 "Cluster Autoscaler:
Dynamic & Automatic Reconfiguration © 2017 mumoshu 16
Dynamic ReconfigurationͷͭΒ͍ͱ͜Ζ • kubectl edit deployment ca͕kubectl edit configmap caʹมΘ͚ͬͨͩͰ
• ͔֬ʹएׯ៉ྷʹεΫϦϓτԽ͘͢͠ͳΔ͚Ͳ • BEFORE: εΫϦϓτdeploymentͷ໊લͱશઃఆɺcaί ϚϯυϥΠϯͷॻ͖͑ํΛΒͳ͍ͱ͍͚ͳ͍ • AFTER: configmapͷ໊લͱઃఆ͚͍ͩͬͯΕ͍͍ Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 17
ͦ͜Ͱ Node Group Automatic Discovery Kubernetes Meetup Tokyo #6 "Cluster
Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 18
Automatic discovery in nutshell ҰݴͰ͍͏ͱɺ CA͕AWS APIΛͬͯASGͷઃఆΛࣗಈಉظͯ͘͠ΕΔػೳ cluster-autoscaler: Re: AWS
Autoscaler autodiscover ASG names and sizes github.com/kubernetes/autoscaler/pull/11 Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 19
How it works ͋ͳͨ: • ASGʹλάΛ͚ͭΔ • CAʹλάΛڭ͑Δ CA: •
λάͷ͍ͭͨASGΛݕ͢Δ ! Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 20
How operating CA improved? BEFORE: cluster-autoscaler --nodes 1:10:myasg-123456 & ASGઃఆมߋͷͨͼʹ͜ͷҾΛରԠͤ͞Δӡ༻
AFTER: cluster-autoscaler --node-group-automatic-discovery asg:tag:key1=val1,key2=val2 & ӡ༻ͷखؒͳ͠ ! Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 21
ࠓͷͱ͜ΖAWSͷΈ • ΠϯλϑΣʔεGCEAzureʹରԠͰ͖ΔΑ͏ʹͬͨ ͭΓ The automatic discovery feature works only
with the AWS provider as of today. However, the common interface is there for you to easily add GCE/Azure supports ! Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 22
GCEରԠΠϝʔδ AWS(Supported): --cloudprovider=aws \ --node-group-automatic-discovery asg:tag:key1=val1,key2=val2 GCE(Unsupported/Imaginary interface): --cloudprovider=gce \
--node-group-automatic-discovery gce:label:key1=val1,key2=val2 An instance group could be "labeled" in GCE, right? Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 23
GCE, AzureରԠٻΉ! Would anyone mind contributing supports for GCE and
Azure to the automatic discovery feature?! Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 24
Supported since CA 0.6 • Automatic DiscoveryCA 0.6͔Β • kube-aws
v0.9.8-rc.1͔Β • CA 0.6͕σϑΥϧτ • Automatic DiscoveryΛΑ͠ͳʹઃఆͯ͘͠ΕΔ Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 25
kube-aws: Configuring CA autoscaling: clusterAutoscaler: enabled: true Kubernetes Meetup Tokyo
#6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 26
kube-aws: Configuring CA per node pool worker: nodePools: # CA
is disabled by default - name: static # CA is enabled only on this node pool - name: dynamic autoscaling: clusterAutoscaler: enabled: true Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 27
·ͱΊ/Recap • CAͷӡ༻ࣗಈԽ/ָʹΦʔτεέʔϦϯά͕͑Δ • ͍·ͷͱ͜ΖAWS͚ͷํ͕ॆ࣮ • Automate a boring operational
task for CA • Dynamic Reconfiguration: supported since CA 0.5.2 • Automatic Discovery: supported on AWS since CA 0.6 • kube-aws supports CA & Automatic Discovery Kubernetes Meetup Tokyo #6 "Cluster Autoscaler: Dynamic & Automatic Reconfiguration © 2017 mumoshu 28