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

Past and future of Infrastructure as Code

Past and future of Infrastructure as Code

Gosuke Miyashita

December 09, 2020
Tweet

More Decks by Gosuke Miyashita

Other Decks in Technology

Transcript

  1. ͸͡Ίʹ • ຊ೔͓࿩͢͠Δ಺༰͸ʰInfra Study Meetup #1ʮInfrastructure as Codeʯʱ1Ͱ͓࿩ͨ͠͠಺༰ͱલ൒͸ಉ͡Ͱ͢ɻ • ҎԼͷϒϩάΤϯτϦ΍ϓϨθϯͷ಺༰Λ࠶ฤͨ͠΋ͷͱͳ͍ͬͯ·͢ɻ

    • Infrastructure as Code ࠶ߟ - Gosuke Miyashita2 • Infrastructure as Code ͷ͜Ε·Ͱͱ͜Ε͔Β at Recruit Technologies Open Lab #033 • Infrastructure as Codeͱ͸Կ͔ͦͯ͠ԿͰ͋Δ΂͖͔ at Codenize Meetup4 • ޙ൒͸ݚڀॴϝϯόʔͱͯ͠औΓ૊ΜͰ͍Δݚڀʹ͍͓ͭͯ࿩͠͠·͢ɻ 4 https://speakerdeck.com/mizzy/infrastructure-as-code-at-codenize-meetup 3 https://speakerdeck.com/mizzy/infrastructure-as-code 2 https://mizzy.org/blog/2016/04/22/1/ 1 https://forkwell.connpass.com/event/171560/ ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 2
  2. ࣗݾ঺հ • ٶԼ ߶ี • https://mizzy.org/, mizzy@github, gosukenator@twitter • ϑϦʔϥϯεͷιϑτ΢ΣΞΤϯδχΞ

    • ͘͞ΒΠϯλʔωοτݚڀॴ٬һݚڀһʢۀ຿ҕୗʣ • matsumotory͞Μ͔Βͷ͓੠͕͚Ͱࡢ೥4݄͔Β • ଞ4ࣾͷ࢓ࣄͯ͠·͢ • 2014೥·ͰϖύϘɺͦͷޙಠཱ ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 3
  3. ֓ཁ • Infrastructure as Codeͷ͜Ε·Ͱ • Infrastructure as Codeͷ͜Ε͔Β •

    ҎԼIaCͱུ͠·͢ ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 4
  4. IaCͷྫ (Chef) package 'nginx' do action :install end service 'nginx'

    do action [:enable, :start] end ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 7
  5. IaCͷྫ (Ansible) - name: install nginx apt: name=nginx - name:

    start nginx service: name=nginx enabled=yes state=started ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 8
  6. IaCͷྫ (Kubernetes) apiVersion: v1 kind: Pod metadata: name: nginx spec:

    containers: - name: nginx-container - image: nginx:1.17 ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 9
  7. IaCͷྫ (Terraform) resource "aws_instance" "example" { ami = "ami-07f4cb4629342979c" instance_type

    = "t3.medium" subnet_id = aws_subnet.private_0.id iam_instance_profile = aws_iam_instance_profile.ec2_for_ssm.name tags = { Name = "example" } } ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 10
  8. IaCͱ͍͏ݴ༿ͷॳग़ • 2008೥ࠒ • ChefࣾCo-FounderͰ͋ΔAdam JcobࢯͷWeb 2.0 Expo San Francisco

    2008ͰͷWhy Startups Need Automated Infrastructuresͱ ͍͏λΠτϧͷϓϨθϯ5 • ͜ͷϓϨθϯ͸ChefͷϦϦʔεલ͕ͩɺChefͷInitial Commit6͸͜Ε ΑΓগ͠લ 6 https://github.com/chef/chef/commit/b5117775e86cff40399187b6292c98fba9dc5034 5 https://www.slideshare.net/adamhjk/why-startups-need-automated-infrastructures ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 11
  9. IaCͷᴈ໌ظ • CFEngineͷӨڹΛड͚ͨPuppetొ৔ (2005೥) • Puppet͕޿͘ड͚ೖΕΒΕΔ • PuppetͷΑ͏ͳConfiguration Managementख๏ΛIaCͱݺ΅ ͏ͱ୭͔͕ݴͬͨʢAdam

    Jcobࢯʁʣ • Adam Jcobࢯ͕Puppet inspiredͳChefΛ։ൃͨ͠ • Chefͷ޿·Γͱͱ΋ʹIaCͱ͍͏ݴ༿΋޿·Δ ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 13
  10. ᴈ໌ظ͸ࣗಈԽ͕য఺ • CFEngingͱ͍͏໊લ͸ʮConfiguration Engineʯ͔Β7 • Puppet࿦จͷλΠτϧ͸ʮPuppet: Next-Generation Configuration Managementʯ 8

    • Adam JcobࢯͷIaCʹؔ͢ΔϓϨθϯͷλΠτϧ͸ʮWhy Startups Need Automated Infrastructuresʯ • ࠷ॳͷয఺͸Configuration ManagementͷࣗಈԽ 8 https://www.usenix.org/publications/login/february-2006-volume-31-number-1/puppet-next-generation-configuration- management 7 Burgess, Mark. "University of Oslo : Cfengine V2.0 : A network configuration tool" (PDF). Iu.hio.no. Archived from the original (PDF) on 2013-07-23. Retrieved 2013-09-08. ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 14
  11. ༨ஊ: ผࢹ఺͔ΒͷIaC • ॻ੶ʮ΢ΣϒΦϖϨʔγϣϯʯ9ͰAdam Jcobࢯ͸ɺ IaC Λʮιʔείʔ υϦϙδτϦɾΞϓϦέʔγϣϯσʔλͷόοΫΞοϓɾαʔόϦιʔ ε͔ΒϏδωεΛ෮چͰ͖ΔΑ͏ʹ͢Δ͜ͱʯͱड़΂͍ͯΔ(2010೥) •

    ౰࣌Adam Jcobࢯ͸σΟβελϦΧόϦతͳࢹ఺͔Β΋IaCΛଊ͍͑ͯ ͨ • ͜Ε΋ࣗಈԽͱ͍͑͹ࣗಈԽͷ࿩Ͱ͸͋Δ 9 https://www.oreilly.co.jp/books/9784873114934/ ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 15
  12. Πϯϑϥ΁ͷΞδϟΠϧͷྲྀೖ • Agile Infrastructure and Operations (2008೥)10 • DevOps (2009೥)

    • IaC͕͜ΕΒͱ݁ͼ͖ͭɺ୯ʹγεςϜ؅ཧΛࣗಈԽ͢ΔͨΊͷ΋ͷͰ͸ͳ͘ɺόʔδϣϯ؅ ཧɺςετɺܧଓతΠϯςάϨʔγϣϯ(CI)ͱ͍ͬͨɺιϑτ΢ΣΞ։ൃͷϓϥΫςΟεΛγ εςϜ؅ཧʹԠ༻͢ΔͨΊͷ΋ͷɺͱҙຯ߹͍͕มΘ͖ͬͯͨ • ͨͩ͠ɺ༗໊ͳʮ10+ Deploys Per Day: Dev and Ops Cooperation at Flickrʯ11ͱ͍͏εϥΠ υʹ͸ʮAutomated infrastructureʯͱ͍͏ݴ༿͕͋ΔΑ͏ʹɺ2009೥౰࣌΋·ͩࣗಈԽ͕য ఺ 11 https://www.slideshare.net/jallspaw/10-deploys-per-day-dev-and-ops-cooperation-at-flickr 10 http://www.jedi.be/presentations/IEEE-Agile-Infrastructure.pdf ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 16
  13. ༨ஊ: DevOpsͱ͍͏ݴ༿ͷॳग़ • ʮ10+ Deploys Per Day: Dev and Ops

    Cooperation at Flickrʯʹ͸ʮDevOpsʯͱ͍͏ݴ༿͸௚઀͸ ग़ͯ͜ͳ͍ • ؍ଌͰ͖ΔݶΓҰ൪ݹ͍ͷ͸ɺ্هεϥΠυʹݴٴͨ͠Andrew Cray ShaferࢯͷπΠʔτ12 • Devopsdays Ghent 2009(࠷ॳͷDevopsdaysΠϕϯτ)13Λओ࠵ͨ͠Patrick Deboisࢯ͕ͭ͘Γग़ͨ͠ ݴ༿ͱ΋ݴΘΕ͍ͯΔ • Agile Infrastructure and Operations΋Patrick DeboisࢯʹΑΔݴ༿ͰDevOpsͷݯྲྀͱݴΘΕ͍ͯΔ • DevOpsͱ͍͏ݴ༿Λͭͬͨ͘ͷ͸Patrick Deboisࢯɺͱ͍͏֬ͨΔূڌ͸ݟ͚ͭΒΕͳ͍͕ɺ Patrick Deboisࢯ͕ʮDevOpsͷ෕ʯͱݺ͹ΕΔ͜ͱʹҟΛএ͑Δਓ͸͍ͳͦ͞͏ 13 https://legacy.devopsdays.org/events/2009-ghent/ 12 https://twitter.com/littleidea/status/2299941379 ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 17
  14. IaCͱ։ൃϓϥΫςΟεͷ༥߹ • 2011೥6݄ʹO'Reilly Media͔Βୈ1൛͕ग़൛͞ΕͨTest- Driven Infrastructure with Chef14 • ʮςετۦಈʯͱ͍͏۩ମతͳϓϥΫςΟε͕ొ৔ͨ͜͠ͱ

    ʹΑΓɺʮܧଓతΠϯςάϨʔγϣϯʯ΍ʮܧଓతσϓϩ Πʯͱ͍ͬͨଞͷϓϥΫςΟεʹ΋޿͕͍ͬͯͬͨ • ੿࡞ͷServerspec΋͜ͷྲྀΕΛՃ଎͢ΔͷʹҰ໾ങ͍ͬͯΔ 14 http://shop.oreilly.com/product/0636920030973.do ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 18
  15. Configuration Management Toolͷݱঢ় • ҎԼCMTͱུ͠·͢ • Puppet, Chef, AnsibleҎ߱ɺ͜Εͱ͍ͬͨCMT͸ग़͖͍ͯͯͳ͍ •

    ࿩୊ͱͯ͠΋Ҏલ΄Ͳݟ͔͚ͳ͘ͳͬͨ • Ansible͸·ͩ໨ʹ͢Δ͜ͱ͕ଟ͍15 16 17 17 GitHub - kubernetes-sigs/kubespray: Deploy a Production Ready Kubernetes Cluster 16 FOSDEM 2020 - Infra Management devroom 15 LINEͷωοτϫʔΫΦʔέετϨʔγϣϯ / network-orchestration - Speaker Deck ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 23
  16. ΑΓྑ͍CMTͱ͸ʁ • CMTར༻ͷίετ͸ҎԼͷ3ͭʹ༝དྷ͢Δ18 • Planning • Deployment • Troubleshooting •

    ͜ͷ3ͭʹ෼ղͯ͠ߟ͑ͯΈΔͱྑͦ͞͏ 18 Burgess, Mark, and Alva L. Couch. 2006. “Modeling Next Generation Configuration Management Tools.” In LISA, 131–47. static.usenix.org.(PDF) ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 25
  17. Planning • Planning includes determining desired behaviors and how to

    accomplish them • CMTͷݴޠͰαʔόʔͷঢ়ଶΛهड़͢Δɺͱ͍͏ͷ͕͜͜ʹ ͋ͨΔͷͰ͸ͳ͍͔ • ιϑτ΢ΣΞʹ͓͚Δ։ൃϑΣʔζ • Planningίετ͸ݴޠಛੑʹେ͖͘ґଘ͢ΔͷͰ͸ ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 26
  18. CMTݴޠʹؔ͢Δݚڀ • PoDIM19΍ConfSolve20ͱ͍ͬͨઌߦݚڀ͕͋Δɻ • γεςϜͷ੍໿ΛϞσϧԽͯ͠ݕূΛߦ͏ɺͱ͍͏఺ʹॏ͖ ͕ஔ͔Ε͍ͯΔɻ 20 Hewson, John A.,

    Paul Anderson, and Andrew D. Gordon. 2012. “A Declarative Approach to Automated Configuration.” In LISA, 12:51–66. usenix.org. 19 Delaet, Thomas, and Wouter Joosen. 2007. “PoDIM: A Language for High-Level Configuration Management.” In Proceedings of the 21st Large Installation System Administration Conference (USENIX LISA’07), 261–73. Usenix Association. ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 28
  19. Deployment • Deployment consists of creating machines with a known

    initial configuration, to which configuration changes can be applied later. • ࣮ࡍʹίʔυΛαʔόʔʹద༻ͯ͠ઃఆΛߦ͏ϑΣʔζɻϓ ϩϏδϣχϯάͱ΋ݺ͹ΕΔɻ ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 29
  20. DeploymentͷλΠϓ • ΫϥΠΞϯτ/αʔόʔܕɺϦϞʔτ࣮ߦܕɺελϯυΞϩϯܕͳ Ͳɺ͍͔ͭ͘λΠϓ͕͋Δɻ • ࠷ۙ͸k8sͰk8sࣗ਎΍ଞͷγεςϜΛ؅ཧ͢Δख๏͕৭ʑग़͖ͯͯ ͍Δɻ21 22 23 24

    25 25 GitHub - aws/aws-controllers-k8s: AWS Controllers for Kubernetes (ACK) is a project enabling you to manage AWS services from Kubernetes 24 Config Connector ͷ֓ཁ | Config Connector ͷυΩϡϝϯτ | Google Cloud 23 Crossplane 22 Metal³ - Metal Kubed 21 GitHub - kubernetes-sigs/cluster-api: Home for the Cluster Management API work, a subproject of sig-cluster-lifecycle ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 30
  21. CMTͷϞσϦϯά • Aspects, Closures, Promisesͱ͍͏֓೦ͰCMTΛϞσϧԽ18 • ͜ͷϞσϧΛطଘͷCMT΍k8sʹ౰ͯ͸ΊͯྨܕԽͰ͖ͳ͍ ͔ɻ • ͔ͦ͜ΒɺΑΓྑ͍ϞσϧΛߟ࡯ͨ͠Γɺk8sͷ΍Γํͷந

    ৅Խ/ҰൠԽ͕Ͱ͖ͳ͍͔ɺͱ͍ͬͨ͜ͱΛߟ͍͑ͯ·͢ɻ 18 Burgess, Mark, and Alva L. Couch. 2006. “Modeling Next Generation Configuration Management Tools.” In LISA, 131–47. static.usenix.org.(PDF) ୈ5ճ͘͞ΒΠϯλʔωοτݚڀձ 2020/10/28 31