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

Kubernetes のソースコードとの付き合い方 #gounco / Kubernetes ...

Kubernetes のソースコードとの付き合い方 #gounco / Kubernetes source code reading

Go(Un)Conference(Goあんこ)LT大会 6kg で発表した資料です
https://gounconference.connpass.com/event/129090/

d-kuro

May 27, 2019
Tweet

More Decks by d-kuro

Other Decks in Programming

Transcript

  1. Kubernetes ͷΞʔΩςΫνϟ API Server Contoroller
 Manager Scheduler etcd API Server

    Kubernetes ͷ ϦιʔεΛ؅ཧ͢Δ API Server શͯͷϦιʔεૢ࡞͸ API Server Λܦ༝ͯ͠ߦ͏
  2. Kubernetes ͷΞʔΩςΫνϟ API Server Contoroller
 Manager Scheduler etcd Contoroller
 Manager

    API Server Ͱ͸Ϧιʔε৘ใͷ CRUD ͙Β͍͔͠ߦͳͬͯ ͓ΒͣɺϦιʔεʹର͢Δ࣮ࡍͷॲཧͷத਎͸ Controller ͱݺ͹ΕΔίϯϙʔωϯτ͕ඇಉظͰߦͳ͍ͬͯΔ Controller (goroutine) Controller (goroutine) Controller (goroutine) ىಈ
  3. Kubernetes ͷΞʔΩςΫνϟ API Server kubelet kube-proxy Pod Pod Pod Internet

    kubelet ֤ϊʔυͰಈ࡞͢Δ Pod Λىಈ, ؅ཧ͢ΔΤʔδΣϯτ kubelet
  4. Kubernetes ͷΞʔΩςΫνϟ API Server kube-proxy Pod Pod Pod Internet kube-proxy

    kubelet ֤ϊʔυͰಈ࡞͢Δ Service ͷఆٛΛݩʹϧʔςΟϯά ͯ͘͠ΕΔωοτϫʔΫϓϩΩγ kube-proxy
  5. Kubernetes ͷΞʔΩςΫνϟ API Server kube-proxy Pod Pod Pod Internet Pod

    Pod Pod kubelet Container Runtime Docker Ҏ֎΋ಈ͘ Pod Pod Pod
  6. Kubernetes ͷιʔείʔυʹ͍ͭͯ • github.com/kubernetes/kubernetes • Go Modules ରԠͯ͠ΔͷͰ go mod

    ίϚϯ υΛ࣮ߦ͢ΔͱϏϧυͰ͖ΔΑ͏ʹͳΔ • ಡΉ࣌͸ IDE ͰίʔυδϟϯϓΛ࢖͓͏ 4݄͙Β͍ʹ Go Modules ରԠͨ͠
 https://github.com/kubernetes/kubernetes/pull/74877
  7. Kubernetes ͷΞʔΩςΫνϟ API Server Contoroller
 Manager Scheduler etcd Contoroller
 Manager

    API Server Ͱ͸Ϧιʔε৘ใͷ CRUD ͙Β͍͔͠ߦͳͬͯ ͓ΒͣɺϦιʔεʹର͢Δ࣮ࡍͷॲཧͷத਎͸ Controller ͱݺ͹ΕΔίϯϙʔωϯτ͕ඇಉظͰߦͳ͍ͬͯΔ Controller (goroutine) Controller (goroutine) Controller (goroutine) ىಈ ͓͞Β͍
  8. • Ϧιʔεʹର͢Δ࣮ࡍͷॲཧͷத਎͸ Controller ͱݺ͹ΕΔί ϯϙʔωϯτ͕ඇಉظͰߦͳ͍ͬͯΔ • ྫ͑͹ Deployment ͷಈ͖ͷ࣮૷͕ݟ͍ͨʂ
 ͬͯͳͬͨ࣌ʹ

    API Server ͷίʔυΛಡΈʹߦͬͯ΋
 Կ΋ॻ͍ͯͳ͍ • Controller Λಡ΋͏ Controller ʹ͍ͭͯ ͜ͷ͜ͱΛ஌Βͣʹ࠷ॳ API Server ͷίʔυಡΜͰ·ͨ͠