Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FinOps! karpenterによるk8sコスト削減

FinOps! karpenterによるk8sコスト削減

Aya (Igarashi) Ozawa

December 11, 2023
Tweet

More Decks by Aya (Igarashi) Ozawa

Other Decks in Technology

Transcript

  1. FinOpsʹ͓͚Δίετͷ࠷ దԽ͸୯ʹҰ൪͍҆Πϯϑ ϥΛ࢖͏ͱ͍͏ҙຯ͚ͩͰ ͸ͳ͍ɻ ෆཁϦιʔε࡟আ౳ͷ Πϯϑϥίετ࡟ݮ WHAT IS COST OPTIMIZATION?

    IT DOES NOT JUST MEAN SAVING INFRASTRUCTURE EXPENSES ӡ༻ޮ཰Խ(ࣗಈԽ)ʹΑΔ ਓతίετ࡟ݮ ΠϯϑϥͷίετΛ҆͘Ͱ ͖ͨͱͯ͠΋ɺͦΕΛҡ࣋ ͢ΔͨΊʹଟ͘ͷखಈΦϖ Ϩʔγϣϯ͕ඞཁʹͳΔͱ ϏδωεʹूதͰ͖ͳ͍ɻ Մ༻ੑ޲্ʹΑΔ ػձଛࣦͷ௿ݮ (≒ ച্૿Ճ) Πϯϑϥͷ͚҆ͩ͞Λ௥ٻ ͯ͠ɺαʔϏε͕ఀࢭͨ͠ Γɺ඼࣭͕ྼԽͯ͠͠·͏ ͱɺϏδωεͷػձଛࣦ͕ ੜ·Εͯ͠·͏ɻ
  2. FinOpsʹ͓͚Δίετͷ࠷ దԽ͸୯ʹҰ൪͍҆Πϯϑ ϥΛ࢖͏ͱ͍͏ҙຯ͚ͩͰ ͸ͳ͍ɻ ෆཁϦιʔε࡟আ౳ͷ Πϯϑϥίετ࡟ݮ WHAT IS COST OPTIMIZATION?

    IT DOES NOT JUST MEAN SAVING INFRASTRUCTURE EXPENSES ӡ༻ޮ཰Խ(ࣗಈԽ)ʹΑΔ ਓతίετ࡟ݮ ΠϯϑϥͷίετΛ҆͘Ͱ ͖ͨͱͯ͠΋ɺͦΕΛҡ࣋ ͢ΔͨΊʹଟ͘ͷखಈΦϖ Ϩʔγϣϯ͕ඞཁʹͳΔͱ ϏδωεʹूதͰ͖ͳ͍ɻ Մ༻ੑ޲্ʹΑΔ ػձଛࣦͷ௿ݮ (≒ ച্૿Ճ) Πϯϑϥͷ͚҆ͩ͞Λ௥ٻ ͯ͠ɺαʔϏε͕ఀࢭͨ͠ Γɺ඼࣭͕ྼԽͯ͠͠·͏ ͱɺϏδωεͷػձଛࣦ͕ ੜ·Εͯ͠·͏ɻ ࠷దͳόϥϯεΛऔΔ
  3. AGENDA Optimize Cost KarpenterʹΑΔίετ࠷ దԽͷ͘͠Έ 04 WHAT YOU CAN LEARN

    TODAY! Optimize More! KarpenterͰΑΓίετΛ ࠷దԽ͢Δʹ͸ 05 Karpenter K8SΫϥελΦʔτεέʔ ϥͷKarpenterͱ͸ 03 Autoscalers ίετ࠷దԽʹ͓͚ΔΦʔ τεέʔϥͷར఺ 02 Cost Optimization ίετ࠷దԽͱ͸? 01
  4. ݱࡏඞཁͱ͢ΔϦιʔεͩ ͚Λ֬อ͢ΔͷͰɺແବͳ ϦιʔεͷίετΛ࡟ݮͰ ͖Δɻ ෆཁϦιʔε࡟আ౳ͷ Πϯϑϥίετ࡟ݮ AUTOSCALER OPTIMIZE COST THE

    BENEFITS OF AUTOSCALER ӡ༻ޮ཰Խ(ࣗಈԽ)ʹΑΔ ਓతίετ࡟ݮ ඞཁͳϦιʔεྔ͕มԽͯ͠ ΋ࣗಈ௥ैͰ͖ΔͷͰɺӡ ༻ऀ͕εέʔϦϯάͷͨΊ ͷϦιʔε؂ࢹ΍࡞ۀΛ࡟ ݮͰ͖Δɻ Մ༻ੑ޲্ʹΑΔ ػձଛࣦͷ௿ݮ (≒ ച্૿Ճ) ਓͷखΛհͣ͞ʹεέʔϦ ϯάͰ͖ΔͷͰɺਓతϛε ΍஗ԆͷϦεΫΛܰݮ͠ɺ Մ༻ੑΛ޲্Ͱ͖Δɻ
  5. ݱࡏඞཁͱ͢ΔϦιʔεͩ ͚Λ֬อ͢ΔͷͰɺແବͳ ϦιʔεͷίετΛ࡟ݮͰ ͖Δɻ ෆཁϦιʔε࡟আ౳ͷ Πϯϑϥίετ࡟ݮ AUTOSCALER OPTIMIZE COST THE

    BENEFITS OF AUTOSCALER ӡ༻ޮ཰Խ(ࣗಈԽ)ʹΑΔ ਓతίετ࡟ݮ ඞཁͳϦιʔεྔ͕มԽͯ͠ ΋ࣗಈ௥ैͰ͖ΔͷͰɺӡ ༻ऀ͕εέʔϦϯάͷͨΊ ͷϦιʔε؂ࢹ΍࡞ۀΛ࡟ ݮͰ͖Δɻ Մ༻ੑ޲্ʹΑΔ ػձଛࣦͷ௿ݮ (≒ ച্૿Ճ) ਓͷखΛհͣ͞ʹεέʔϦ ϯάͰ͖ΔͷͰɺਓతϛε ΍஗ԆͷϦεΫΛܰݮ͠ɺ Մ༻ੑΛ޲্Ͱ͖Δɻ ֤ίετΛ࡟ݮͰ͖Δ!!
  6. AGENDA Optimize Cost KarpenterʹΑΔίετ࠷ దԽͷ͘͠Έ 04 WHAT YOU CAN LEARN

    TODAY! Karpenter K8SΫϥελΦʔτεέʔ ϥͷKarpenterͱ͸ 03 Autoscalers ίετ࠷దԽʹ͓͚ΔΦʔ τεέʔϥͷར఺ 02 Optimize More! KarpenterͰΑΓίετΛ ࠷దԽ͢Δʹ͸ 05 Cost Optimization ίετ࠷దԽͱ͸? 01
  7. THE TYPES OF AUTOSCALERS KUBERNETES AUTOSCALING Workload(/Pod) Autoscaling Cluster(/Node) Autoscaling

    Pod Node scale Pod Pod Node scale Pod Pod Node scale Pod New! Node
  8. LESS MANUAL OPERATION, FASTER SCALE (AWS) WHAT IS DIFFERENT FROM

    CAS? Kubernetes Cluster Autoscaler (CAS) Karpenter CAS Pod Node Pod Pod 1. Unschedulable Node 2. Create a new node from NG Node Group AWS ASG
  9. LESS MANUAL OPERATION, FASTER SCALE (AWS) WHAT IS DIFFERENT FROM

    CAS? Kubernetes Cluster Autoscaler (CAS) Karpenter CAS Pod Node Pod Pod Node Node Group AWS ASG Large Node Group AWS ASG Small 1. Unschedulable 2. Create a new node from NG (small)
  10. LESS MANUAL OPERATION, FASTER SCALE (AWS) WHAT IS DIFFERENT FROM

    CAS? Kubernetes Cluster Autoscaler (CAS) Karpenter CAS Pod Node Pod Pod Node Karpenter Pod Node Pod Node AWS Fleet Node Pool Node Group AWS ASG Pod 1. Unschedulable 2. Create a new Node
  11. LESS MANUAL OPERATION, FASTER SCALE (AWS) WHAT IS DIFFERENT FROM

    CAS? Kubernetes Cluster Autoscaler (CAS) Karpenter CAS Pod Node Pod Pod Node Karpenter Pod Node Pod Pod Node 1. Unschedulable 2. Create a new (medium) Node AWS Fleet Node Pool Node Group AWS ASG
  12. LESS MANUAL OPERATION, FASTER SCALE (AWS) WHAT IS DIFFERENT FROM

    CAS? Kubernetes Cluster Autoscaler (CAS) Karpenter • Node͸CASͷNodeGroup(NG)ઃఆʹैͬ ͯ௥Ճ͞ΕΔ (AWSͰ͸EC2 ASGʹରԠ) • ௥Ճ͢ΔNodeͷγϛϡϨʔτʹ͸NG͝ͱ ʹ1छྨͷNodeαΠζ͕࢖ΘΕΔ • ৽͍͠ΠϯελϯελΠϓͷNodeΛCAS͔ Βੜ੒͢Δʹ͸NGͷ௥Ճ͕ඞཁͰɺ·ͨɺ NG͕ଟ͗͢Δͱεέʔϧʹ͕͔͔࣌ؒΔ • Node͸NodePoolʹॻ͔Εͨ࡞੒͢Δϊʔ ͷ੍໿ࣄ߲ΛݩʹKarpenter͕બ୒͢Δ • ௥Ճ͢ΔNodeͷγϛϡϨʔτ͸NodePool Λݩʹ༷ʑͳαΠζͷNode͕࢖ΘΕΔ • AWSͷ৔߹ɺΠϯελϯεΛEC2 ASGΛܦ ༝ͤͣʹEC2 Fleet͔Β௚઀্ཱͪ͛ΔͷͰ CASʹൺ΂ΔͱΠϯελϯεͷىಈ͕ૣ͍
  13. LESS MANUAL OPERATION, FASTER SCALE (AWS) WHAT IS DIFFERENT FROM

    CAS? Kubernetes Cluster Autoscaler (CAS) Karpenter • Node͸CASͷNodeGroup(NG)ઃఆʹैͬ ͯ௥Ճ͞ΕΔ (AWSͰ͸EC2 ASGʹରԠ) • ௥Ճ͢ΔNodeͷγϛϡϨʔτʹ͸NG͝ͱ ʹ1छྨͷNodeαΠζ͕࢖ΘΕΔ • ৽͍͠ΠϯελϯελΠϓͷNodeΛCAS͔ Βੜ੒͢Δʹ͸NGͷ௥Ճ͕ඞཁͰɺ·ͨɺ NG͕ଟ͗͢Δͱεέʔϧʹ͕͔͔࣌ؒΔ • Node͸NodePoolʹॻ͔Εͨ࡞੒͢Δϊʔ ͷ੍໿ࣄ߲ΛݩʹKarpenter͕બ୒͢Δ • ௥Ճ͢ΔNodeͷγϛϡϨʔτ͸NodePool Λݩʹ༷ʑͳαΠζͷNode͕࢖ΘΕΔ • AWSͷ৔߹ɺΠϯελϯεΛEC2 ASGΛܦ ༝ͤͣʹEC2 Fleet͔Β௚઀্ཱͪ͛ΔͷͰ CASʹൺ΂ΔͱΠϯελϯεͷىಈ͕ૣ͍ ख࡞ۀ͕ݮΓɺ ΑΓૣ͘εέʔϧͰ͖Δ!
  14. AGENDA Optimize Cost KarpenterʹΑΔίετ࠷ దԽͷ͘͠Έ 04 WHAT YOU CAN LEARN

    TODAY! Karpenter K8SΫϥελΦʔτεέʔ ϥͷKarpenterͱ͸ 03 Autoscalers ίετ࠷దԽʹ͓͚ΔΦʔ τεέʔϥͷར఺ 02 Optimize More! KarpenterͰΑΓίετΛ ࠷దԽ͢Δʹ͸ 05 Cost Optimization ίετ࠷దԽͱ͸? 01
  15. CREATE THE RIGHT SIZE INSTANCE AND DELETE THE UNNECESSARY INSTANCE

    KARPENTER OPTIMIZES COSTS! Provisioning Karpenter Node AWS Fleet Node Pool Pod Pod Pod Pod Pod Pod Pod Pod 1. Grouping pending Pods and Finding f itting candidates. 3. Create an optimal instance based on strategy • Pending PodΛ·ͱΊͯϑΟοτ͢ΔNode ͷछྨΛ୳͢(BinPacking, FFD Algorithm) • ϑΟοτ͢Δ΋ͷΑΓେ͖͍max 60ީิͷ ͏ͪɺઓུʹԠͨ͡࠷దͳΠϯελϯε͕ ىಈͰ͖Δ on-demand: lowest-price (࠷΋͍҆΋ͷ) spot: price-capacity-optimized (҆͘தஅՄೳੑͷ௿͍΋ͷ) 2. Send max 60 Candidates Save Costs!
  16. CREATE THE RIGHT SIZE INSTANCE AND DELETE THE UNNECESSARY INSTANCE

    KARPENTER OPTIMIZES COSTS! Disruption Controllers • Expiration: ಛఆ͕࣌ؒܦաͨ͠Β࡟আ • Consolidation: Node্ͷશͯͷPod͕ଞͷNode ʹҠಈՄೳͳΒ࡟আɺ·ͨ͸ɺݱࡏͷΠϯελϯ εΑΓ͍҆Πϯελϯε͕ར༻ՄೳͳΒஔ׵ • Drift: NodePoolͷઃఆ͕มߋ͞ΕɺطଘͷΠϯε λϯε͕๬·͍͠ঢ়ଶͱͷࠩ෼͕ͰͨΒ࡟আ͢Δ • Interruption: SpotΠϯελϯεͷఀࢭ΍ UnhealthyʹͳͬͨΒஔ׵͢Δ Karpenter Pod Node Pod Node Pod Node Delete Unnecessary or Costly Nodes Save Costs!
  17. Node A Pod Node A Pod Pod CREATE THE RIGHT

    SIZE INSTANCE AND DELETE THE UNNECESSARY INSTANCE KARPENTER OPTIMIZES COSTS! Disruption Controllers • Expiration: ಛఆ͕࣌ؒܦաͨ͠Β࡟আ • Consolidation: Node্ͷશͯͷPod͕ଞͷNode ʹҠಈՄೳͳΒ࡟আɺ·ͨ͸ɺݱࡏͷΠϯελϯ εΑΓ͍҆Πϯελϯε͕ར༻ՄೳͳΒஔ׵ • Drift: NodePoolͷઃఆ͕มߋ͞ΕɺطଘͷΠϯε λϯε͕๬·͍͠ঢ়ଶͱͷࠩ෼͕ͰͨΒ࡟আ͢Δ • Interruption: SpotΠϯελϯεͷఀࢭ΍ UnhealthyʹͳͬͨΒஔ׵͢Δ Pod Expire 2h Delete after 2 hours
  18. CREATE THE RIGHT SIZE INSTANCE AND DELETE THE UNNECESSARY INSTANCE

    KARPENTER OPTIMIZES COSTS! Disruption Controllers Node A Pod Node B Pod Node A’ Pod Pod $0.05 $0.02 Recreate a new node Reallocate a Pod • Expiration: ಛఆ͕࣌ؒܦաͨ͠Β࡟আ • Consolidation: Node্ͷશͯͷPod͕ଞͷNode ʹҠಈՄೳͳΒ࡟আɺ·ͨ͸ɺݱࡏͷΠϯελϯ εΑΓ͍҆Πϯελϯε͕ར༻ՄೳͳΒஔ׵ • Drift: NodePoolͷઃఆ͕มߋ͞ΕɺطଘͷΠϯε λϯε͕๬·͍͠ঢ়ଶͱͷࠩ෼͕ͰͨΒ࡟আ͢Δ • Interruption: SpotΠϯελϯεͷఀࢭ΍ UnhealthyʹͳͬͨΒஔ׵͢Δ Pod
  19. CREATE THE RIGHT SIZE INSTANCE AND DELETE THE UNNECESSARY INSTANCE

    KARPENTER OPTIMIZES COSTS! Disruption Controllers • Expiration: ಛఆ͕࣌ؒܦաͨ͠Β࡟আ • Consolidation: Node্ͷશͯͷPod͕ଞͷNode ʹҠಈՄೳͳΒ࡟আɺ·ͨ͸ɺݱࡏͷΠϯελϯ εΑΓ͍҆Πϯελϯε͕ར༻ՄೳͳΒஔ׵ • Drift: NodePoolͷઃఆ͕มߋ͞ΕɺطଘͷΠϯε λϯε͕๬·͍͠ঢ়ଶͱͷࠩ෼͕ͰͨΒ࡟আ͢Δ • Interruption: SpotΠϯελϯεͷఀࢭ΍ UnhealthyʹͳͬͨΒஔ׵͢Δ Node A Pod Node A’ Pod Recreate Im age v1 Im age v2 Desired state of machine image was changed from v1 to v2. Node Pool v2
  20. Node A CREATE THE RIGHT SIZE INSTANCE AND DELETE THE

    UNNECESSARY INSTANCE KARPENTER OPTIMIZES COSTS! Disruption Controllers • Expiration: ಛఆ͕࣌ؒܦաͨ͠Β࡟আ • Consolidation: Node্ͷશͯͷPod͕ଞͷNode ʹҠಈՄೳͳΒ࡟আɺ·ͨ͸ɺݱࡏͷΠϯελϯ εΑΓ͍҆Πϯελϯε͕ར༻ՄೳͳΒஔ׵ • Drift: NodePoolͷઃఆ͕มߋ͞ΕɺطଘͷΠϯε λϯε͕๬·͍͠ঢ়ଶͱͷࠩ෼͕ͰͨΒ࡟আ͢Δ • Interruption: SpotΠϯελϯεͷఀࢭ΍ UnhealthyʹͳͬͨΒஔ׵͢Δ Spot Spot interruptions have a 2-minute notice Node A’ Pod Pod Recreate
  21. CREATE THE RIGHT SIZE INSTANCE AND DELETE THE UNNECESSARY INSTANCE

    KARPENTER OPTIMIZES COSTS! Provisioning Disruption Controllers • Pending PodΛ·ͱΊͯϑΟοτ͢ΔNode ͷछྨΛ୳͢(BinPacking, FFD Algorithm) • ϑΟοτ͢Δ΋ͷΑΓେ͖͍max 60ީิͷ ͏ͪɺઓུʹԠͨ͡࠷దͳΠϯελϯε͕ ىಈͰ͖Δ on-demand: lowest-price (࠷΋͍҆΋ͷ) spot: price-capacity-optimized (҆͘தஅՄೳੑͷ௿͍΋ͷ) • Expiration: ಛఆ͕࣌ؒܦաͨ͠Β࡟আ • Consolidation: Node্ͷશͯͷPod͕ଞͷNode ʹҠಈՄೳͳΒ࡟আɺ·ͨ͸ɺݱࡏͷΠϯελϯ εΑΓ͍҆Πϯελϯε͕ར༻ՄೳͳΒஔ׵ • Drift: NodePoolͷઃఆ͕มߋ͞ΕɺطଘͷΠϯε λϯε͕๬·͍͠ঢ়ଶͱͷࠩ෼͕ͰͨΒ࡟আ͢Δ • Interruption: spotͷΠϯελϯεͷఀࢭ΍ UnhealthyʹͳͬͨΒஔ׵͢Δ CASΑΓΞάϨογϒ ͳͷͰ஫ҙ!
  22. CREATE THE RIGHT SIZE INSTANCE AND DELETE THE UNNECESSARY INSTANCE

    KARPENTER OPTIMIZES COSTS! Provisioning Disruption Controllers • Pending PodΛ·ͱΊͯϑΟοτ͢ΔNode ͷछྨΛ୳͢(BinPacking, FFD Algorithm) • ϑΟοτ͢Δ΋ͷΑΓେ͖͍max 60ީิͷ ͏ͪઓུʹԠͨ͡࠷దͳΠϯελϯε͕ى ಈ͞ΕΔ on-demand: lowest-price (࠷΋͍҆΋ͷ) spot: price-capacity-optimized (҆͘தஅՄೳੑͷ௿͍΋ͷ) • Expiration: ಛఆ͕࣌ؒܦաͨ͠Β࡟আ • Consolidation: Node্ͷશͯͷPod͕ଞͷNode ʹҠಈՄೳͳΒ࡟আɺ·ͨ͸ɺݱࡏͷΠϯελϯ εΑΓ͍҆Πϯελϯε͕ར༻ՄೳͳΒஔ׵ • Drift: NodePoolͷઃఆ͕มߋ͞ΕɺطଘͷΠϯε λϯε͕๬·͍͠ঢ়ଶͱͷࠩ෼͕ͰͨΒ࡟আ͢Δ • Interruption: spotͷΠϯελϯεͷఀࢭ΍ UnhealthyʹͳͬͨΒஔ׵͢Δ CASΑΓΞάϨογϒ ͳͷͰ஫ҙ! ίετΛ࠷దԽ! ඞཁͳϦιʔε͚ͩ࡞੒ ෆཁͳϦιʔε͸࡟আ ✕ ࣗಈԽ
  23. AGENDA Optimize Cost KarpenterʹΑΔίετ࠷ దԽͷ͘͠Έ 04 WHAT YOU CAN LEARN

    TODAY! Karpenter K8SΫϥελΦʔτεέʔ ϥͷKarpenterͱ͸ 03 Autoscalers ίετ࠷దԽʹ͓͚ΔΦʔ τεέʔϥͷར఺ 02 Optimize More! KarpenterͰΑΓίετΛ ࠷దԽ͢Δʹ͸ 05 Cost Optimization ίετ࠷దԽͱ͸? 01
  24. CHARACTERISTICS OF PURCHASE TYPES AND COST EC2 INSTANCE PURCHASE TYPES

    On-Demand On-Demand Instance EC2ΠϯελϯεͷఆՁɻ Spot Instance धཁͱڙڅʹԠͯ͡Ձ͕֨ௐ੔͞ΕΔɻΠϯελϯ εͷ࡟আ͕͋Δ͕ɺେ෯ʹׂҾ͔ΕΔ͜ͱ͕ଟ͍ɻ SavingsPlans / Reserved Instance 1-3೥ͷOn-Demandͷ௕ظίϛοτΛࣄલܖ໿͢Δ ͜ͱͰɺେ෯ͳׂҾΛड͚Δϓϥϯɻ࡟আ͸ͳ͍ɻ
  25. CHARACTERISTICS OF PURCHASE TYPES AND COST EC2 INSTANCE PURCHASE TYPES

    On-Demand Instance EC2ΠϯελϯεͷఆՁɻ Spot Instance धཁͱڙڅʹԠͯ͡Ձ͕֨ௐ੔͞ΕΔɻΠϯελϯ εͷ࡟আ͕͋Δ͕ɺେ෯ʹׂҾ͔ΕΔ͜ͱ͕ଟ͍ɻ SavingsPlans / Reserved Instance 1-3೥ͷOn-Demandͷ௕ظίϛοτΛࣄલܖ໿͢Δ ͜ͱͰɺେ෯ͳׂҾΛड͚Δϓϥϯɻ࡟আ͸ͳ͍ɻ m5.large t2.medium c4.xlarge spot spot pool spot pool
  26. CHARACTERISTICS OF PURCHASE TYPES AND COST EC2 INSTANCE PURCHASE TYPES

    On-Demand Instance EC2ΠϯελϯεͷఆՁɻ Spot Instance धཁͱڙڅʹԠͯ͡Ձ͕֨ௐ੔͞ΕΔɻΠϯελϯ εͷ࡟আ͕͋Δ͕ɺେ෯ʹׂҾ͔ΕΔ͜ͱ͕ଟ͍ɻ SavingsPlans / Reserved Instance 1-3೥ͷOn-Demandͷ௕ظίϛοτΛࣄલܖ໿͢Δ ͜ͱͰɺେ෯ͳׂҾΛड͚Δϓϥϯɻ࡟আ͸ͳ͍ɻ 1-3 years max 72% off
  27. KARPENTER USES PUBLIC ON-DEMAND AND SPOT INSTANCE RATE DISCOUNT PLAN

    NOT SUPPORTED KarpenterͱߪೖΦϓγϣϯ • αϙʔτ͍ͯ͠ΔߪೖΦϓγϣϯ͸ ެ։ϨʔτͷOn-DemandͱSpotͷ ΈͰɺׂҾϓϥϯʹ͍ͭͯ͸ߟྀ͞ Εͳ͍ • Reserved Instance΍Savings Plan ͸ɺSpotͷΑ͏ʹΠϯελϯε͕ಥ વ࡟আ͞ΕΔ͜ͱ΋ͳ͘ɺίετ࡟ ݮʹΑ͘࢖ΘΕ͍ͯΔΦϓγϣϯ Flexera 2023 State of the Cloud Report
  28. IN CASE YOU HAVE A SAVINGS PLAN FOR $0.047/HR EXAMPLE:

    COST IS NOT OPTIMIZED ҎԼͷSavings PlansΛܖ໿ͨ͠৔߹… 3 years EC2 Savings Plan Compute Instance Max Savings 66% 72% t3.large Sample (ఆՁ: $0.1088) $0.062 (43%) $0.047 (57%) Locked Single Instance Family & Region No Yes t3.large, Tokyo Region, 3 years, No Upfront, Linux ※ 2023/11/15 21:00 ࣌఺ Savings Plans for K8S Nodes $0.047 t3.large t3.large 1 hour t3.large t3.large • Instance Saving PlanͷTokyo Region, t3.largeΛ3೥ؒ • 1࣌ؒ͋ͨΓ$0.047Λܖ໿ 57% off
  29. IN CASE YOU HAVE A SAVINGS PLAN FOR $0.047/HR EXAMPLE:

    COST IS NOT OPTIMIZED c5.largeͷOn-Demand͕࡞੒͞Εͨ৔߹ Instance Type Purchase Type Price (Discount) c5.large On-demand $0.096 t3.large On-demand $0.1088 SavingsPlan $0.047 (57%) t3.large, Tokyo Region, 3 years, No Upfront, Linux ※ 2023/11/15 21:00 ࣌఺ EC2 Instance Pricing List • c5.largeͷOn-demand͸t3.largeΑΓ͍҆ • c5.large͕࡞੒͞ΕΔͱ௥ՃͰ$0.096ͷ௥Ճίετ c5.large t3.large +$0.096 $0.047 Karpenter 1 hour < Compare with c5.large and t3.large on-demand rate.
  30. +$0.033 t3.large IN CASE YOU HAVE A SAVINGS PLAN FOR

    $0.047/HR EXAMPLE: COST IS NOT OPTIMIZED t3.largeͷSpot͕࡞੒͞Εͨ৔߹ Instance Type Purchase Type Price (Discount) t3.large On-demand $0.1088 Spot $0.033 (73%) SavingsPlan $0.047 (57%) t3.large, Tokyo Region, 3 years, No Upfront, Linux ※ 2023/11/15 21:00 ࣌఺ EC2 Instance Pricing List • t3.largeͷSpot͸t3.largeͷOn-demandΑΓ͍҆ • SpotͰ࡞੒͞ΕΔͱ௥ՃͰ$0.033ͷ௥Ճίετ t3.large $0.047 Karpenter 1 hour < Compare with t3.large spot and on-demand rate. spot
  31. EXAMPLE: COST IS NOT OPTIMIZED IN CASE YOU HAVE A

    SAVINGS PLAN FOR $0.047/HR Unoptimized Optimized! 👍 Unused Savings Plans
  32. Optimized! 👍 EXAMPLE: COST IS NOT OPTIMIZED IN CASE YOU

    HAVE A SAVINGS PLAN FOR $0.047/HR Unoptimized Unused Savings Plans ίετ࠷దԽʹ͸SavingsPlanͷ࢖༻཰্͕ ͕ΔΑ͏ͳߟྀ΋ඞཁ!
  33. • Savings PlanΛߪೖͨ͠ΞΧ΢ϯτ(΋͘͠ ͸ڞ༗͍ͯ͠Δ૊৫)಺ͷଞͷk8sΫϥελ ΍ɺk8sҎ֎Ͱ࢖ΘΕ͍ͯΔΠϯελϯεͷ ߟྀ͕ඞཁ • Savings Plan͸όϥόϥͳ࣌ظʹෳ਺ߪೖ ͢Δ͜ͱ΋ଟ͍ͷͰɺͦΕͧΕͷϓϥϯͷ

    ঢ়گΛखಈͰ؅ཧ͢Δͷ΋େม • GetSavingsPlansUtilization API͸1೔୯Ґͳ ͷͰཻ౓͕͋Β͗͢Δ • ίετͱ࢖༻ঢ়گϨϙʔτ(AWS CUR) ͔Β1 ࣌ؒ୯Ґͷར༻཰ΛऔಘͰ͖Δ͕ɺجຊత ʹલ೔ͷσʔλʹͳΔ HOW CAN WE CALCULATE SAVINGS PLAN UTILIZATION? CHALLENGING PARTS Savings Planͷར༻཰ΛϦΞϧλΠϜʹऔ ಘ͢ΔAPI͕ଘࡏ͠ͳ͍ K8sΫϥελ಺ͷΠϯελϯε৘ใ͚ͩͰ ͸ར༻཰͕ܭࢉͰ͖ͳ͍
  34. • Savings PlanΛߪೖͨ͠ΞΧ΢ϯτ(΋͘͠ ͸ڞ༗͍ͯ͠Δ૊৫)಺ͷଞͷk8sΫϥελ ΍ɺk8sҎ֎Ͱ࢖ΘΕ͍ͯΔΠϯελϯεͷ ߟྀ͕ඞཁ • Savings Plan͸όϥόϥͳ࣌ظʹෳ਺ߪೖ ͢Δ͜ͱ΋ଟ͍ͷͰɺͦΕͧΕͷϓϥϯͷ

    ঢ়گΛखಈͰ؅ཧ͢Δͷ΋େม • GetSavingsPlansUtilization API͸1೔୯Ґͳ ͷͰཻ౓͕͋Β͗͢Δ • ίετͱ࢖༻ঢ়گϨϙʔτ(AWS CUR) ͔Β1 ࣌ؒ୯Ґͷར༻཰ΛऔಘͰ͖Δ͕ɺجຊత ʹલ೔ͷσʔλʹͳΔ HOW CAN WE CALCULATE SAVINGS PLAN UTILIZATION? CHALLENGING PARTS Savings Planͷར༻཰ΛϦΞϧλΠϜʹऔ ಘ͢ΔAPI͕ଘࡏ͠ͳ͍ K8sΫϥελ಺ͷΠϯελϯε৘ใ͚ͩͰ ͸ར༻཰͕ܭࢉͰ͖ͳ͍ CUR͔ΒSavings Plan৘ใΛूܭ ✕ ݱࡏͷશΠϯελϯεঢ়گΛऩू → Savings Planͷར༻཰ΛγϛϡϨʔτ
  35. PREDICT PLANS UTILIZATION FEEDBACK ON PREDICATED RESULTS TO KARPENTER S3

    Agent Karpenter Node Pool Cost Usage Report Kubernetes Cluster 1. Process CUR & Predicate SavingsPlan Utilization Server Node Pool Node Pool 2. Send Instance Information & Get Predicate Result 3. Update NodePool according to predication Cost Usage Report Upload Create Optimal Node!
  36. Optimize Cost KarpenterʹΑΔίετ࠷ దԽͷ͘͠Έ 04 Cost Optimization ίετ࠷దԽͱ͸? 01 Autoscalers

    ίετ࠷దԽʹ͓͚ΔΦʔ τεέʔϥͷར఺ 02 Optimize More! KarpenterͰΑΓίετΛ ࠷దԽ͢Δʹ͸ 05 🏆 AGENDA WHAT YOU CAN LEARN TODAY! Karpenter K8SΫϥελΦʔτεέʔ ϥͷKarpenterͱ͸ 03