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
430
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.3k
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
9k
Helmfile - A declarative way to deploy Helm charts -
mumoshu
5
9.5k
Other Decks in Technology
See All in Technology
Fediverse Discovery Providers overview
andypiper
0
110
スーパーマリオRPGのリメイク版の変更点からみるUX
nishiharatsubasa
1
320
プロダクトエンジニアを支えるための開発生産性向上施策
tsukakei
0
140
20240906_JAWS_Yamanashi_#1_leap_beyond_the_AWS_all_certifications
tsumita
1
270
LandingZoneAccelerator と学ぶ 「スケーラブルで安全なマルチアカウントAWS環境」と 私たちにもできるベストプラクティス
maimyyym
1
130
デジタル化・DX推進あるある
y150saya
0
240
すぐに始めるAWSコスト削減。短期でできる改善策と長期的な運用負荷軽減への取り組み方を解説
ncdc
1
550
サーバレスでモバイルアプリ開発! NTTコム「ビジネスdアプリ」のアーキテクチャ / The architecture of business d app
nttcom
12
220
LLVM/ASMを使った有限体の高速実装
herumi
0
120
プログラム検証入門
riru
0
200
ロリポップ! for Gamersを支えるインフラ/lolipop for gamers infrastructure
takumakume
0
120
社内の学びの場・コミュニティ形成とエンジニア同士のリレーションシップ構築/devreljapan2024
nishiuma
3
200
Featured
See All Featured
A designer walks into a library…
pauljervisheath
201
24k
Why You Should Never Use an ORM
jnunemaker
PRO
53
8.9k
How GitHub Uses GitHub to Build GitHub
holman
472
290k
Speed Design
sergeychernyshev
21
420
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Designing for Performance
lara
604
68k
RailsConf 2023
tenderlove
27
800
Building Your Own Lightsaber
phodgson
101
6k
Being A Developer After 40
akosma
83
580k
VelocityConf: Rendering Performance Case Studies
addyosmani
322
23k
Clear Off the Table
cherdarchuk
91
320k
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