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

究極のInfrastructure as Codeを目指して

究極のInfrastructure as Codeを目指して

Infra Study Meetup #1「Infrastructure as Code」のLT資料です
https://forkwell.connpass.com/event/171560/

C51ed1e43b09bfbbb09eead09f803aea?s=128

Shin'ya Ueoka

April 24, 2020
Tweet

More Decks by Shin'ya Ueoka

Other Decks in Technology

Transcript

  1. ڀۃͷ*OGSBBT$PEFΛ ໨ࢦͯ͠ Infra Study Meetup #1 “Infrastructure as Code” αΠϘ΢ζגࣜձࣾ

    @ueokande
  2. .F ‰্Ԭ ਅ໵ (@ueokande) ‰αΠϘ΢ζגࣜձࣾ ‰ٳ೔͸OSS΍จষΛॻ͍ͨΓ ‰kintone.comͱ͍͏αʔϏε
 ͷ։ൃɾӡ༻Λ͍ͯ͠·͢ 2

  3. LJOUPOFDPN ‰γεςϜΛ؆୯ʹ࡞ΕΔB2B޲͚αʔϏε ‰ࠃ಺֎15,000+ࣾͰಋೖ ‰άϩʔόϧࢢ৔޲͚͸AWS্Ͱӡ༻ 3

  4. LJOUPOFDPNͷߏ੒ 4 ֤αʔϏε͕ར༻͢Δ ϚωʔδυαʔϏε Amazon EKS Service A Service B

    Service C Service D Service E Service F Service G Service H LJOUPOFDPNΛߏ੒ ͢ΔαʔϏε܈ ‰͜ͷߏ੒ΛInfra as CodeͰߏஙɾӡ༻ Ϛωʔδυ,VCFSOFUFT
  5. ‰Infra as Codeʹ͓͍ͯɺιʔείʔυ͸։ൃऀ͕
 ࡞Γ͍ͨཧ૝ঢ়ଶ (࠷ऴతͳΠϯϑϥߏ੒) ‰γεςϜ͸ݱࡏͷঢ়ଶͱཧ૝ঢ়ଶͷࠩ෼ΛຒΊΔ • ͦΕΛ͢Δͷ͕terraform΍Ansible ཧ૝ঢ়ଶ΁ͷऩଋ 5

    ద༻ޙͷ ঢ়ଶ ݱࡏͷ ঢ়ଶ ཧ૝
  6. LJOUPOFDPNͷϨϙδτϦ ‰ϞϊϨϙʹAWSͷߏ੒ͱαʔϏεΛؚΉ • ϨϙδτϦͷঢ়ଶ͕Πϯϑϥͷཧ૝ঢ়ଶ 6 Amazon EKS Service A Service

    B Service C Service D Service E Service F Service G Service H CloudFormation Service A Service Z ιʔείʔυʢϞϊϨϙʣ $MPVE'PSNBUJPO͕ ཧ૝ঢ়ଶʹΠϯϑϥΛઃఆ ,VCFSOFUFT্ͷαʔϏε΋ ࠩ෼ݕ஌ˍߋ৽͍ͨ͠ ͜ͷࠩ෼Λ Ͳ͏ຒΊΔ͔ʁ
  7. αʔϏεͷߋ৽ ‰੒Ռ෺ͷࠩ෼ݕ஌ͯࠩ͠෼͕͋Ε͹σϓϩΠ • ΠϝʔδΛߏ੒͢ΔϑΝΠϧͷϋογϡ஋ΛΠϝʔδλάͱ͢Δ • ιʔείʔυ͕มߋ͞ΕΔͱϦϏϧυͯ͠docker push 7 ϋογϡؔ਺ H

    ( ) %PDLFSpMF ઃఆ ϑΝΠϧ . . spec: containers: - name: my-service-a image: quay.io/cybozu/my-service-a:BKCXSIF3Z3GEH2OEIM5BLEQBP4 ιʔε ίʔυ ιʔείʔυ͕มߋ͞ΕΔͱ Πϝʔδλά΋৽͘͠ͳΔ ϥΠϒϥϦ .
  8. ྫϕʔεΠϝʔδͷ+7.ߋ৽ ϕʔεΠϝʔδΛߋ৽ʢηΩϡϦςΟରԠͳͲʣ (1) ϕʔεΠϝʔδͷDockerfileΛߋ৽ (2) Dockerfile͔ΒϕʔεΠϝʔδΛϦϏϧυ (3) ϕʔεΠϝʔδ͔Β֤छαʔϏεΛϦϏϧυ (4) ΠϝʔδλάͰdocker

    push (5) λάͷΠϝʔδΛkubectl apply 8
  9. ϕʔεΠϝʔδͷߋ৽ 9 Service A ϕʔεΠϝʔδ Service B ιʔείʔυʢϞϊϨϙʣ Amazon EKS

    4FSWJDF " 4FSWJDF # 4FSWJDF $ ߋ৽ ֤αʔϏεΛϦϏϧυ ʢdocker build && docker pushʣ ৽͍͠ΠϝʔδΛల։
 ʢkubectl applyʣ 4FSWJDF " 4FSWJDF # 4FSWJDF $ σϓϩΠ
 ύΠϓϥΠϯ ΠϝʔδλάΛιʔείʔυ͔Βܭࢉ ϕʔε Πϝʔδ
  10. ྫϕʔεΠϝʔδͷ+7.ߋ৽ ϕʔεΠϝʔδΛߋ৽ʢηΩϡϦςΟରԠͳͲʣ (1) ϕʔεΠϝʔδͷDockerfileΛߋ৽ (2) Dockerfile͔ΒϕʔεΠϝʔδΛϦϏϧυ (3) ϕʔεΠϝʔδ͔Β֤छαʔϏεΛϦϏϧυ (4) ΠϝʔδλάͰdocker

    push (5) λάͷΠϝʔδΛkubectl apply 10 ࣮ࡍͷखॱ͸ ͜Ε͚ͩ ͋ͱ͸ࣗಈͰ ຊ൪ʹద༻
  11. 11

  12. CloudFormationͷద༻ KubernetesϚχϑΣετͷద༻ ςετ࣮ߦ JVMαʔϏεΛϦϏϧυˍ ৽͍͠ΠϝʔδλάͰdocker push ৽͍͠ΠϝʔδλάΛద༻ JVMϕʔεΠϝʔδΛϏϧυ JVMҎ֎ͷαʔϏε

  13. ڀۃͷ*OGSBBT$PEFΛ໨ࢦͯ͠ ‰ιʔείʔυ͸ࠓͷΠϯϑϥͷঢ়ଶΛද͢ ‰ίʔυΛมߋ͢Δɺ͢ͳΘͪຊ൪ద༻ ‰ϩʔϧόοΫ΋git revertͯ͠Ϛʔδ͢Δ͚ͩ 13