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

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

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

Cad656ed619672b702191833dc819943?s=128

d-kuro

May 27, 2019
Tweet

Transcript

  1. 2.
  2. 3.
  3. 11.

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

    Kubernetes ͷ ϦιʔεΛ؅ཧ͢Δ API Server શͯͷϦιʔεૢ࡞͸ API Server Λܦ༝ͯ͠ߦ͏
  4. 12.

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

    API Server Ͱ͸Ϧιʔε৘ใͷ CRUD ͙Β͍͔͠ߦͳͬͯ ͓ΒͣɺϦιʔεʹର͢Δ࣮ࡍͷॲཧͷத਎͸ Controller ͱݺ͹ΕΔίϯϙʔωϯτ͕ඇಉظͰߦͳ͍ͬͯΔ Controller (goroutine) Controller (goroutine) Controller (goroutine) ىಈ
  5. 17.

    Kubernetes ͷΞʔΩςΫνϟ API Server kubelet kube-proxy Pod Pod Pod Internet

    kubelet ֤ϊʔυͰಈ࡞͢Δ Pod Λىಈ, ؅ཧ͢ΔΤʔδΣϯτ kubelet
  6. 18.

    Kubernetes ͷΞʔΩςΫνϟ API Server kube-proxy Pod Pod Pod Internet kube-proxy

    kubelet ֤ϊʔυͰಈ࡞͢Δ Service ͷఆٛΛݩʹϧʔςΟϯά ͯ͘͠ΕΔωοτϫʔΫϓϩΩγ kube-proxy
  7. 19.

    Kubernetes ͷΞʔΩςΫνϟ API Server kube-proxy Pod Pod Pod Internet Pod

    Pod Pod kubelet Container Runtime Docker Ҏ֎΋ಈ͘ Pod Pod Pod
  8. 21.

    Kubernetes ͷιʔείʔυʹ͍ͭͯ • github.com/kubernetes/kubernetes • Go Modules ରԠͯ͠ΔͷͰ go mod

    ίϚϯ υΛ࣮ߦ͢ΔͱϏϧυͰ͖ΔΑ͏ʹͳΔ • ಡΉ࣌͸ IDE ͰίʔυδϟϯϓΛ࢖͓͏ 4݄͙Β͍ʹ Go Modules ରԠͨ͠
 https://github.com/kubernetes/kubernetes/pull/74877
  9. 28.
  10. 30.

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

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

    • Ϧιʔεʹର͢Δ࣮ࡍͷॲཧͷத਎͸ Controller ͱݺ͹ΕΔί ϯϙʔωϯτ͕ඇಉظͰߦͳ͍ͬͯΔ • ྫ͑͹ Deployment ͷಈ͖ͷ࣮૷͕ݟ͍ͨʂ
 ͬͯͳͬͨ࣌ʹ

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