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

kube-state-metrics Sharding

d-kuro
November 02, 2022

kube-state-metrics Sharding

d-kuro

November 02, 2022
Tweet

More Decks by d-kuro

Other Decks in Programming

Transcript

  1. Kubernetes controller ͷ Sharding • controller ͸௨ৗɺϦʔμʔબग़ͰϦʔμʔͱͳͬͨ Pod ͷΈ͕ 


    reconcile Λߦ͏ͱ͍͏Ξϓϩʔνʹͳ͍ͬͯΔ https://speakerdeck.com/daikurosawa/leader-election-in-kubernetes-number-k8sjp
  2. • ͪΐͬͱલʹ࿩୊ʹͳͬͨ΍ͭ • Sharder ͕ϥϕϧΛׂΓৼͬͯ 
 ͲͷγϟʔυͰॲཧ͢Δ͔Λ 
 ܾఆ͢Δ •

    ͬͪ͜ͷ࿩͸ࠓ೔͸͠·ͤΜ Kubernetes controller ͷ Sharding https://github.com/timebertt/thesis-controller-sharding/blob/master/assets/design-overview.pdf
  3. kube-state-metrics ͷ Sharding • ࠓճͷςʔϚ͸ controller Ͱ͸ͳ͍͚Ͳ 
 kube-state-metrics ͕

    controller Ͱ΋࢖༻Ͱ͖ΔΞϓϩʔνͰ 
 Sharding Λߦ͏ػೳ͕࣮૷͞Ε͍ͯΔͨΊɺͦͷ঺հΛ͠·͢
  4. kube-state-metrics ͷ Sharding Pod1 Pod2 1. CM1 Metrics 2. CM3

    Metrics Export Metrics api-server 1. CM1 2. CM2 3. CM3 4. CM4 Con fi gMap List 1. CM2 Metrics 2. CM4 Metrics Export Metrics
  5. ࣮૷ • kube-state-metrics Λ StatefulSet Ͱಈ͔͢ • ϨϓϦΧ਺ͱ Pod ͷ຤ඌͷ൪߸͔Β

    
 Կ൪໨ͷγϟʔυͳͷ͔ݕग़͢Δ • Kubernetes ͷΦϒδΣΫτͷ UID Λ༻͍ͯ 
 Consistent Hash ͠ɺॲཧ͢ΔγϟʔυΛܾఆ͢Δ
  6. ࣮૷ • kube-state-metrics Λ StatefulSet Ͱಈ͔͢ • ϨϓϦΧ਺ͱ Pod ͷ຤ඌͷ൪߸͔Β

    
 Կ൪໨ͷγϟʔυͳͷ͔ݕग़͢Δ • Kubernetes ͷΦϒδΣΫτͷ UID Λ༻͍ͯ 
 Consistent Hash ͠ɺॲཧ͢ΔγϟʔυΛܾఆ͢Δ
  7. ࣮૷ • kube-state-metrics Λ StatefulSet Ͱಈ͔͢ • ϨϓϦΧ਺ͱ Pod ͷ຤ඌͷ൪߸͔Β

    
 Կ൪໨ͷγϟʔυͳͷ͔ݕग़͢Δ • Kubernetes ͷΦϒδΣΫτͷ UID Λ༻͍ͯ 
 Consistent Hash ͠ɺॲཧ͢ΔγϟʔυΛܾఆ͢Δ
  8. kube-state-metrics ͷΞʔΩςΫνϟ kube-state-metrics Ͱ΋ Re fl ector Λ࢖༻ ਤͷΑ͏ʹ Delta

    FIFO Queue ʹ ΦϒδΣΫτΛ֨ೲ͢ΔͷͰͳ͘ ϝτϦΫεΛ֨ೲ͢Δ MetricStore Λ࣮૷͍ͯ͠Δ
  9. σϝϦοτ • StatefulSet ͷϩʔϧΞ΢τʹىҼ͢ΔσϝϦοτ • ϩʔϧΞ΢τ͕ 1 ୆ͣͭߦΘΕΔͨΊ஗͍ • Pod

    ͷ࡟আ͕ઌʹ࣮ࢪ͞ΕΔ • ͜ͷλΠϛϯάͰ Prometheus ͷεΫϨΠϓ͕ൃੜ͢Δͱ 
 ϝτϦΫεͷܽଛʹܨ͕ΔՄೳੑ͕͋Δ • List & Watch ͷ෦෼͸γϟʔσΟϯάͰ͖ͳ͍ͨΊɺ 
 ର৅ͱͳΔશΦϒδΣΫτΛਫ਼ࠪ͢Δ෼ͷϦιʔε͕ඞཁͱͳΔ