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
2.1k
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
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
250
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
670
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
Jetpack Composeで始めるServer Cache State
ogaclejapan
2
160
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
210
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
440
なぜCodeceptJSを選んだか
goataka
0
160
.NET 9 のパフォーマンス改善
nenonaninu
0
690
Wantedly での Datadog 活用事例
bgpat
1
420
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Fireside Chat
paigeccino
34
3.1k
Why Our Code Smells
bkeepers
PRO
335
57k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
4 Signs Your Business is Dying
shpigford
181
21k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.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