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

Kubernetes を利用したデプロイ自動化基盤

ktr
May 20, 2017

Kubernetes を利用したデプロイ自動化基盤

ktr

May 20, 2017
Tweet

More Decks by ktr

Other Decks in Technology

Transcript

  1. Kubernetes Λ࢖ͬͨ σϓϩΠࣗಈԽج൫ @A(izu)LT ձ௡ฤ 0x02

  2. $ whoami • ੨໦ଠ࿠ (@ktr_0731) • ρ s123 • Web

    • STEINS;GATEɺڹ͚ʂϢʔϑΥχΞϜ
  3. ؀ڥ • ਓ਺͕͋·Γଟ͘ͳ͍ձࣾ • WebɺαʔόɺϞόΠϧ͝ͱʹϦϙδτϦ͕ ෼͔Ε͍ͯΔ • खಈϏϧυɾσϓϩΠ

  4. ؀ڥ • ਓ਺͕͋·Γଟ͘ͳ͍ձࣾ • WebɺαʔόɺϞόΠϧ͝ͱʹϦϙδτϦ͕ ෼͔Ε͍ͯΔ • खಈϏϧυɾσϓϩΠ

  5. ؀ڥ • ਓ਺͕͋·Γଟ͘ͳ͍ձࣾ • WebɺαʔόɺϞόΠϧ͝ͱʹϦϙδτϦ͕ ෼͔Ε͍ͯΔ • खಈσϓϩΠ

  6. ςετ؀ڥ΁ͷσϓϩΠ ʹ͕͔͔࣌ؒΔ

  7. ςετ؀ڥ΁ͷσϓϩΠ ʹ͕͔͔࣌ؒΔ ↓ ࣗಈԽͷඞཁੑ

  8. ཁૉ • Slack Bot • CI αʔό • Docker •

    Kubernetes
  9. Docker • (େࡶ೺ʹ͍͏ͱ) ؀ڥΛίϯςφԽ͢Δٕज़ • Docker ΠϝʔδʹΞϓϦέʔγϣϯΛೖΕͯ ଞʹґଘΛٴ΅ͣ͞ʹಈ͔ͤΔ • Immutable

    Infrastructure
  10. • a.k.a. k8s • Docker ίϯςφͷΦʔέετϨʔγϣϯπʔϧ • ΫϥελϦϯά • ίϯςφ܈ͷىಈɺఀࢭɺϨϓϦέʔγϣϯ

  11. • 1ͭҎ্ͷ Docker Πϝʔδ͔Β Pod Λ࡞੒ • ֤ Node ʹ෼ࢄͯ͠഑ஔ

  12. • namespace Ͱ؀ڥΛ෼͚Δ͜ͱ͕Ͱ͖Δ • Ͳͷ؀ڥʹσϓϩΠ͢Δ͔ߟ͑Δඞཁ͕ͳ͍

  13. • namespace Ͱ؀ڥΛ෼͚Δ͜ͱ͕Ͱ͖Δ • Ͳͷ؀ڥʹσϓϩΠ͢Δ͔ߟ͑Δඞཁ͕ͳ͍ • Ͳ͜Ͱಈ͍͍ͯΔ͔ߟ͑ͳͯ͘ྑ͍

  14. • namespace Ͱ؀ڥΛ෼͚Δ͜ͱ͕Ͱ͖Δ • Ͳͷ؀ڥʹσϓϩΠ͢Δ͔ߟ͑Δඞཁ͕ͳ͍ • Ͳ͜Ͱಈ͍͍ͯΔ͔ߟ͑ͳͯ͘ྑ͍ • Ͳ͏ಈ͍͍ͯΔ͔͚ͩߟ͑Ε͹ྑ͍

  15. αʔϏεͷެ։ apiVersion: v1 kind: Service metadata: name: sample-server labels: name:

    sample-server spec: type: LoadBalancer ports: - port: 80 protocol: TCP targetPort: 8080 selector: name: sample-server
  16. αʔϏεͷެ։ • type=LoadBalancer Ͱ LB ͕࡞੒͞ΕɺΞϓ Ϧέʔγϣϯ͕ެ։͞ΕΔ • AWS ͳͲͷαϙʔτ͞ΕͨҰ෦ͷΈ

    • kubernetes/ingress
  17. σϓϩΠʹඞཁͳઃఆϑΝΠϧ • service.yaml (͖ͬ͞ͷઃఆ) • deployment.yaml • ϨϓϦΧ਺ͷࢦఆ • Pod

    ͷߏ੒ͷهड़
  18. $ kubectl create -n test -f service.yaml $ kubectl create

    -n test -f deployment.yaml
  19. ཁૉ • Slack Bot • CI αʔό • Docker •

    Kubernetes
  20. Slack Bot • ChatOps • ୭Ͱ΋ςετ؀ڥʹσϓϩΠ͕Ͱ͖Δ

  21. None
  22. Ұ࿈ͷྲྀΕ • Bot ʹσϓϩΠΛ఻͑Δ • CI ͕σϓϩΠϞʔυͰಈ͘ • CI ্Ͱ

    Kubernetes ΁ͷσϓϩΠεΫϦϓτ Λ࣮ߦ • σϓϩΠ׬ྃ
  23. Ұ࿈ͷྲྀΕ • Bot ʹσϓϩΠΛ఻͑Δ • CI ͕σϓϩΠϞʔυͰಈ͘ • CI ্Ͱ

    Kubernetes ΁ͷσϓϩΠεΫϦϓτ Λ࣮ߦ • σϓϩΠ׬ྃ
  24. ՝୊ • ݱࡏ͸ςετ؀ڥͷΈͷ࢖༻ • ͍ͣΕϓϩμΫγϣϯ؀ڥͰ΋࢖͍͍ͨ • ஌ݟ͕ཷ·͍ͬͯͳ͍ • k8s ͷجຊ֓೦͸஌Δඞཁ͕͋Δ

  25. ·ͱΊ • Kubernetes • ෳ਺ͷಠཱͨ͠؀ڥΛ࡞੒Ͱ͖Δ • Ͳ͜Ͱಈ͍͍ͯΔ͔Λߟ͑ͣʹࡁΉ • k8s ͰσϓϩΠ͕ࣗಈͰͰ͖ΔΑ͏ʹͳͬͨ

  26. ࢀߟ • https://speakerdeck.com/koudaiii/number- devsumie • Wantedly TechBook #2

  27. Thanks for your attention!