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

dynamic-environment-setup-and-teardown-with-git...

Tatch
May 13, 2021

 dynamic-environment-setup-and-teardown-with-gitlab-and-k8s

「JX Press Tech Talk #backend 速報サービスを支えるバックエンドの技術」で発表した『GitLabとKubernetesで作る自動で起動・停止できるブランチ別環境』の資料です

https://jxpress.connpass.com/event/210867/

Tatch

May 13, 2021
Tweet

More Decks by Tatch

Other Decks in Programming

Transcript

  1. Who am I? ฏ੉ ୡ໵(Tatsuya Hirase ) ◦ @TatchNicola s

    ◦ SR E ◦ Ϊλʔ/ࣗసं/֎ࠃޠ(ӳޠͱதࠃޠ͕ͪΐͬͱͰ͖Δ)
  2. 1,ࠔ͍ͬͯͨ͜ͱ ͋Δ͋Δʁ։ൃ؀ڥͷॱ൪଴ͪ • ϩʔΧϧͰ֬ೝ͠ʹ͍͘΋ͷ ◦ Ϋϥ΢υݻ༗ͷػೳ(e.g. Amazon SQS, Firestore )

    ◦ ݖݶͷ֬ೝ(ඞཁͳIAM࣋ͬͯΔ͔ʁ ) ◦ ґଘ͢Δɾ͞ΕͯΔϚΠΫϩαʔϏε(docker-composeͰ...? ) • ʮͪΐͬͱݟͯ΄͍͠ʯʮͪΐͬͱAPIୟ͍ͯཉ͍͠ʯ ◦ ։ൃऀ <-> σβΠφʔɺPd M ◦ ϑϩϯτ <-> όοΫΤϯυ ◦ GraphQL BFF <-> REST API
  3. 1,ࠔ͍ͬͯͨ͜ͱ • Merge Request(GitHubͰ͍͏Pull Request)͝ͱʹ
 ࣗಈͰ؀ڥͱURL͕෷͍ग़͞ΕΔ
 -> Istio • Merge

    Request͕ด͡ΒΕͨΒɺͦͷ؀ڥ΋ด͡ΒΕΔ
 -> Helm & GitLab CI Ͳ͏͢Ε͹଴ͪΛͳͤ͘Δʁ
  4. 2,Ͳ͏΍ͬͯղܾ͔ͨ͠ ϦϙδτϦઓུ • ΞϓϦέʔγϣϯϦϙδτϦ : ◦ CIͰ͸lintɺςετɺίϯςφΠϝʔδͷ࡞੒·ͰΛ୲౰͢Δ • ϚχϑΣετϦϙδτϦ :

    ◦ k8sϚχϑΣετ(=HelmςϯϓϨʔτ)Λ؅ཧ ◦ ։ൃ൛ΫϥελͷτϐοΫϒϥϯνผ؀ڥ΁ͷσϓϩΠ ◦ ArgoCD͕͜ͷϦϙδτϦͷmainϒϥϯνΛΫϥελʹಉظ͢Δ CIఆ͕ٛγϯϓϧʹͳΓɺςϯϓϨʔτͱͯ͠ڞ௨ԽͰ͖ͨ
  5. 2,Ͳ͏΍ͬͯղܾ͔ͨ͠ • Isti o ◦ τϥϑΟοΫ੍ޚΛݸผͷϦϙδτϦ΁ҕৡ͠΍͍͢ ◦ ʮALB+ECSʯorʮEKS+IngressʯͩͱதԝूݖʹͳΓ͕ͪ • Hel

    m ◦ ຊ൪؀ڥɾ։ൃ؀ڥɾτϐοΫϒϥϯνผ؀ڥͷࠩ෼Λٵऩ ◦ 2छྨͷσϓϩΠઓུͷ઀ணࡎ(ޙड़ ) • GitLab C I ◦ “Environments” ʹ؀ڥΛରԠͤͯ͞ಠཱσϓϩΠΛ࣮ݱ ◦ ؀ڥͷ࡞੒ɾഁغͷͨΊͷτϦΨʔఆ͕͍͍ٛײ͡ʹͰ͖Δ
  6. 3, ·ͱΊ • ෳ਺ͷ؀ڥΛಈతʹੜ੒ɾഁغͰ͖Δ࢓૊ΈΛͭͬͨ͘ ◦ ؀ڥͷॱ൪଴͕ͪͳ͘ͳͬͯ։ൃ଎౓U P ◦ ϦϞʔτϫʔΫͰ΋ʮͪΐͬͱίϨݟͯ/ୟ͍ͯʯ͕༰қʹ •

    ϦϙδτϦΛࡉ͔͘෼͚ɺCIͱCDΛ෼཭͢Δ͜ͱͰؔ৺͝ͱΛখ͘͞อͭ • GitOpsͱCIOps͸ೋऀ୒Ұ͡Όͳ͍ ◦ ໨తʹ͋Θͤͯ྆ํ࢖͏͜ͱ΋Ͱ͖Δ ◦ ઀ணࡎͱͯ͠ͷHelm