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

    View full-size slide

  2. $ whoami
    • ੨໦ଠ࿠ (@ktr_0731)
    • ρ s123
    • Web
    • STEINS;GATEɺڹ͚ʂϢʔϑΥχΞϜ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    ࣗಈԽͷඞཁੑ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  16. αʔϏεͷެ։
    • type=LoadBalancer Ͱ LB ͕࡞੒͞ΕɺΞϓ
    Ϧέʔγϣϯ͕ެ։͞ΕΔ
    • AWS ͳͲͷαϙʔτ͞ΕͨҰ෦ͷΈ
    • kubernetes/ingress

    View full-size slide

  17. σϓϩΠʹඞཁͳઃఆϑΝΠϧ
    • service.yaml (͖ͬ͞ͷઃఆ)
    • deployment.yaml
    • ϨϓϦΧ਺ͷࢦఆ
    • Pod ͷߏ੒ͷهड़

    View full-size slide

  18. $ kubectl create -n test -f service.yaml
    $ kubectl create -n test -f deployment.yaml

    View full-size slide

  19. ཁૉ
    • Slack Bot
    • CI αʔό
    • Docker
    • Kubernetes

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  23. ՝୊
    • ݱࡏ͸ςετ؀ڥͷΈͷ࢖༻
    • ͍ͣΕϓϩμΫγϣϯ؀ڥͰ΋࢖͍͍ͨ
    • ஌ݟ͕ཷ·͍ͬͯͳ͍
    • k8s ͷجຊ֓೦͸஌Δඞཁ͕͋Δ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  26. Thanks for your attention!

    View full-size slide