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

KubeCon+CNConに見るetcdの未来

 KubeCon+CNConに見るetcdの未来

Akihiro Ikezoe

January 09, 2019
Tweet

More Decks by Akihiro Ikezoe

Other Decks in Technology

Transcript

  1. KubeCon + CNCon ʹݟΔ
    etcd ͷະདྷ
    Cloud Native Meetup Tokyo #6
    2019೥1݄9೔
    ஑ఴ ໌޺

    View full-size slide

  2. • Akihiro IKEZOE (@zoetro)
    • αΠϘ΢ζגࣜձࣾۈ຿
    • Πϯϑϥ࡮৽ϓϩδΣΫτ
    • ࣗࣾσʔληϯλʔʹKubernetesΫϥελΛߏங
    • αʔόʔػࡐͷϥΠϑαΠΫϧ؅ཧͷࣗಈԽ΍ɺKubernetesΫϥελͷӡ༻ࣗ
    ಈԽπʔϧΛ։ൃ͍ͯ͠Δ
    2
    ࣗݾ঺հ

    View full-size slide

  3. KubeCon + CloudNativeCon North America 2018
    • αΠϘ΢ζ͔Β͸7໊ͰࢀՃ͠·ͨ͠ɻ
    • KubeCon + CloudNativeCon North America 2018 ݱ஍Ϩϙʔτ
    • IUUQTCMPHDZCP[VJPFOUSZ
    • IUUQTCMPHDZCP[VJPFOUSZ
    • IUUQTCMPHDZCP[VJPFOUSZ
    • IUUQTCMPHDZCP[VJPFOUSZ
    3

    View full-size slide

  4. etcdؔ࿈ηογϣϯ
    • Keynote: 5 Years of etcd: Past, Present, and Future
    • What's Next for etcd Cluster Management?
    • Intro: Cluster Lifecycle SIG
    • Debugging etcd
    • Deep Dive: etcd
    4

    View full-size slide

  5. etcd
    • CoreOSࣾ(ݱRed Hatࣾ)͕։ൃ͢Δ෼ࢄΩʔόϦϡʔετΞ
    • ಛ௃
    • )JHI"WBJMBCMF
    • 4USPOH$POTJTUFODZ.PEFM
    • 3BGUʹΑΔ෼ࢄ߹ҙ
    • 5SBOTBDUJPO 8BUDI -FBTF
    • ϦʔμʔΤϨΫγϣϯͳͲ෼ࢄγεςϜʹඞཁͳػೳΛఏڙ
    • Kubernetes, Vitess, CoreDNSͳͲ਺ଟ͘ͷ෼ࢄγεςϜͷόο
    ΫΤϯυͱͯ͠ར༻͞Ε͍ͯΔɻ
    5

    View full-size slide

  6. etcdͷະདྷ
    Keynote: 5 Years of etcd: Past, Present, and Future

    View full-size slide

  7. CoreOSࣾͷOSS͸Ͳ͏ͳΔͷ͔ʁ
    • CoreOS͕Red Hatʹങऩ͞ΕɺRed Hat΋IBMʹങऩ͞ΕΔ༧ఆɻ
    • Container Linux
    • 'FEPSB$PSF04͕ޙܧͱͳΔɻ
    • ೥͍ͬͺ͍͸ϝϯςφϯε͞ΕΔ༧ఆɻ
    • rkt
    • 3FE )BUͱͯ͠։ൃ͸ܧଓ͠ͳ͍ɻ'FEPSB$PSF04ʹ΋౥ࡌ͞Εͳ͍ɻ
    • etcd
    • Ͳ͏ͳΔʁ
    7

    View full-size slide

  8. https://www.cncf.io/blog/2018/12/11/cncf-to-host-etcd/ 8

    View full-size slide

  9. etcd͕CNCFϓϩδΣΫτʹ
    • Red Hat͔ࣾΒCNCFʹدଃ͞Εͨɻ
    • etcdͷϝϯςφ͸΋ͱ΋ͱCoreOSͷ֎ͷਓ͕ଟ͍ͷͰɺ
    ։ൃମ੍ʹେ͖ͳมԽ͸ͳͦ͞͏ɻ
    • ࠓޙ͸࢖͍΍͢͞΍҆ఆੑ΍ੑೳͷվળͳͲ͕த৺ɻ
    • υΩϡϝϯτͷ੔උ΋ظ଴͞ΕΔɻ
    9

    View full-size slide

  10. etcdͷ৽ػೳ
    What's Next for etcd Cluster Management?

    View full-size slide

  11. ࠓޙetcdʹಋೖ͞ΕΔػೳ
    • 3BGU-FBSOFS FUDEW

    • FUDEPQFSBUPS1FSTJTUFOU7PMVNF4VQQPSU
    FUDEPQFSBUPSW

    • 4FSWFS%PXOHSBEF FUDEW

    • $MVTUFSJOJU ఏҊத

    11

    View full-size slide

  12. 3BGU-FBSOFS
    12

    View full-size slide

  13. • ωοτϫʔΫ෼அ΍ύέοτϩεͳͲͷো֐͕ൃੜ͠
    ͯ΋ɺσʔλͷෆ੔߹Λൃੜͤ͞ͳ͍͜ͱΛอূ͢Δɻ
    • Ϋϥελ಺͔ΒϦʔμʔΛબग़͢Δɻ
    Ϧʔμʔ͔ΒଞͷϝϯόʔʹϋʔτϏʔτΛૹ৴͠
    Ϧʔμʔ͕1͔͍ͭ͠ͳ͍͜ͱΛอূ͢Δɻ
    • ϦʔμʔΛؚΉա൒਺ͷϝϯόʔ͕߹ҙͨ͠ͱ͖ʹ
    σʔλΛίϛοτ͢Δ͜ͱ͕Ͱ͖Δɻ
    13
    Raft: etcdͷ෼ࢄ߹ҙΞϧΰϦζϜ

    View full-size slide

  14. Network Partition (Split Brain)
    https://youtu.be/5kAVOQ4APok 14

    View full-size slide

  15. • Ϋϥελʹ৽͍͠ϝϯόΛ௥Ճͨ͠ͱ͖ɺσʔλͷಉظ͕׬ྃ
    ͢Δ·Ͱʹ͕͔͔࣌ؒΔɻ
    • σʔλͷಉظ͕׬͍ྃͯ͠ͳ͍ϝϯόʔ΋ɺ෼ࢄ߹ҙͷϝϯ
    όʔͱͯ͠Χ΢ϯτ͞ΕΔɻ
    15
    ݱঢ়ͷ໰୊఺ʢલఏʣ

    View full-size slide

  16. • σʔλಉظத͸I/Oෛՙ͕ߴ͍ɻϦʔμʔ͔ΒͷϋʔτϏʔτ
    ϦΫΤετͷλΠϜΞ΢τ͕ൃੜ͠΍͘͢ͳΔɻ
    • σʔλಉظதʹωοτϫʔΫ෼அ͕ൃੜ͢ΔͱɺຊདྷͳΒো֐
    ʹ଱͑͏ΔέʔεͰ΋Ϋϥελ่յ͕ൃੜͯ͠͠·͏ɻ
    • ϝϯόʔΛ௥Ճ͢Δͱ͖ʹىಈύϥϝʔλΛϛε͍ͬͯΔͱɺ
    Quorum Size͚ͩ૿͑ͯނোͨ͠ϝϯόʔ͕Ϋϥελʹ௥Ճ͞
    Εͯ͠·͏ɻ
    16
    ݱঢ়ͷ໰୊఺

    View full-size slide

  17. 17
    σʔλಉظલͷωοτϫʔΫ෼அ
    https://youtu.be/5kAVOQ4APok

    View full-size slide

  18. Raft Learner
    18
    https://youtu.be/5kAVOQ4APok

    View full-size slide

  19. $MVTUFSJOJU
    19

    View full-size slide

  20. etcdͷىಈΦϓγϣϯ
    20

    View full-size slide

  21. • etcdΫϥελΛ্ཱͪ͛ΔͨΊʹ͸ɺϝϯόʔ͝ͱʹ໊લ΍ɺ
    Ϧοεϯ͢ΔΞυϨεɺଞͷϝϯόʔʹ޿ࠂ͢ΔURLΛࢦఆ͢
    Δඞཁ͕͋Δɻ
    • ͜ΕΒͷύϥϝʔλΛࢦఆ͠ͳͯ͘΋ɺDNSΛར༻ͯ͠ɺࣗಈ
    తʹ໊લ΍ΞυϨεΛղܾ͢Δ࢓૊Έ͕ఏҊ͞Ε͍ͯΔɻ
    • etcdϝϯόʔͷ্ཱ͕ͪ͛ඇৗʹ؆୯ʹͳΔʂ
    21
    Cluster init

    View full-size slide

  22. etcdadm
    Intro: Cluster Lifecycle SIG

    View full-size slide

  23. etcdͷӡ༻͸େม
    • etcd͸ඇৗʹ؆୯ʹ࢖͍࢝ΊΔ͜ͱ͕Ͱ͖Δɻ
    • ͔͠͠ɺຊ൪؀ڥͰӡ༻͠Α͏ͱࢥ͏ͱɺHAߏ੒ʹͨ͠Γɺ
    ূ໌ॻΛ؅ཧͨ͠ΓɺΫϥελ่͕յ͠ͳ͍Α͏ʹϝϯόΛ௥
    Ճɾ࡟আͨ͠Γɺ͍Ζ͍Ζ೉͍͠ɻ
    • ӡ༻ΛࣗಈԽ͢Δπʔϧ͕ඞཁͱͳΔ
    • Kubernetes্ͷetcdΫϥελͷӡ༻
    ὎ FUDEPQFSBUPS
    • ࣮ػ΍VM্ͷetcdΫϥελͷӡ༻͸ʁ
    23

    View full-size slide

  24. etcdadm
    https://youtu.be/vtBc0f1ACbM 24

    View full-size slide

  25. • ࣮ػ΍7.޲͚ͷFUDEΫϥελӡ༻ࣗಈԽπʔϧ
    • ,VCFSOFUFT LVCFBQJTFSWFS
    ޲͚ʹಛԽ
    • $MVTUFS-JGFDZDMF 4*(ʹͯఏҊத
    • QMBUGPSNFUDEBEN ͱ LPQFJPFUDENBOBHFS Λϕʔεʹ࣮ͯ͠૷͕ਐΊΒΕΔ༧ఆɻ
    • FUDEΫϥελͷߏங΍ӡ༻ΛࣗಈԽͯ͘͠ΕΔ
    • ϝϯόʔͷ௥Ճ΍࡟আ
    • όοΫΞοϓͱϦετΞ σΟβελʔϦΧόϦʔ

    • ΞοϓάϨʔυɺμ΢ϯάϨʔυ
    • ূ໌ॻͷ؅ཧ
    25
    etcdadm

    View full-size slide

  26. τϥϒϧγϡʔςΟϯά
    Debugging etcd

    View full-size slide

  27. σόοάͷΞϓϩʔν
    https://youtu.be/NVMZBBQ9hsM
    27

    View full-size slide

  28. σόοάʹศརͳπʔϧ
    • etcdctl
    • FUDEΛૢ࡞͢ΔͨΊͷඪ४πʔϧɻ
    • auger
    • ,VCFSOFUFT͸QSPUPCVGܗࣜͰFUDEʹσʔλΛ֨ೲ͍ͯ͠Δɻ
    • ͜ͷσʔλΛσίʔυͯ͠දࣔͯ͘͠ΕΔπʔϧɻ
    • etcd-dump-logs
    • 8"-ͷMPHΛμϯϓͯ͠ɺFUDEʹରͯ͠ͲͷΑ͏ͳૢ࡞͕͓͜ͳΘΕ
    ͔ͨΛ֬ೝ͢Δ͜ͱ͕Ͱ͖Δπʔϧɻ
    28

    View full-size slide

  29. Q&Aܗࣜͷηογϣϯ
    Deep Dive: etcd

    View full-size slide

  30. Deep Dive: etcd
    https://youtu.be/GJqO1TYzVDE 30

    View full-size slide

  31. ؾʹͳͬͨQ&A
    • ͳͥσʔλαΠζʹ੍ݶ͕͋Δͷ͔ʁ
    • σϑΥϧτͰ2GBʢ࠷େ8GBʣͷ੍ݶ͕͋Δɻ
    • σʔλϕʔεϑΝΠϧΛmmap͢ΔͨΊɺσʔλྔ෼ͷϝϞϦ͕ඞཁɻ
    • ͳͥίϯύΫγϣϯ͕ඞཁͳͷ͔ʁ
    • Ωʔ͝ͱͷཤྺΛอ͍࣋ͯ͠Δɻ
    • ݹ͍ཤྺΛ࡟আ͠ͳ͍ͱɺσʔλ༰ྔ͕૿͑ϦετΞ࣌ؒ΋૿େ͢Δɻ
    • ͳͥI/OϨΠςϯγʹහײͳͷ͔ʁ
    • ఆظతʹϦʔμʔ͔ΒϑΥϩϫʔʹϋʔτϏʔτΛૹ৴ͯ͠ɺ෼ࢄ߹ҙͷϝ
    λσʔλΛϑΝΠϧʹอଘ͍ͯ͠Δɻ
    • ϑΝΠϧॻ͖ࠐΈ͕஗͍ͱϋʔτϏʔτ͕λΠϜΞ΢τ͢Δɻ(v3.4Ͱվળʁ)
    • ग़དྷΔ͚ͩSSDΛ࢖͏΂͖ɻ
    31

    View full-size slide

  32. ·ͱΊ
    • etcd͸KubernetesΛ࢝Ί͍Ζ͍Ζͳͱ͜ΖͰ࢖ΘΕ͍ͯͯɺ
    ͳͯ͘͸ͳΒͳ͍ଘࡏɻ
    • CNCFϓϩδΣΫτʹՃΘͬͨ͜ͱ΋͋Γɺࠓޙͷϝϯςφϯ
    ε͸҆৺ͯ͠ྑͦ͞͏ɻ
    • ։ൃऀ޲͚ͷେ͖ͳ৽ػೳ͸͋·Γͳͦ͞͏͚ͩͲɺӡ༻ऀ޲
    ͚ʹ͸خ͍͠ػೳ͕͍Ζ͍Ζग़͖ͯͦ͏ɻ
    33

    View full-size slide