$30 off During Our Annual Pro Sale. View Details »

Kubernetes と CI/CD の 活用について

k725
January 27, 2021

Kubernetes と CI/CD の 活用について

k725

January 27, 2021
Tweet

More Decks by k725

Other Decks in Technology

Transcript

  1. Kubernetes ͱ CI/CD ͷ ׆༻ʹ͍ͭͯ

  2. Agenda • ͸͡Ίʹ • γεςϜ֓ཁ • Kubernetes ͷ׆༻ • GitHub

    Actions Ͱͷ CI/CD • ࠓޙͷվળ఺
  3. ͸͡Ίʹ

  4. ୭ • ύʔιϧΩϟϦΞגࣜձࣾ 
 αʔϏεاը։ൃຊ෦ • খྛ Ղ࢙ • ۀ຿:

    Πϯϑϥ, ηΩϡϦςΟͷ ΞυόΠεɾۀ຿؀ڥվળͳͲ • झຯ: ϓϩάϥϛϯά, OPSEC, OSINT, ͓ण࢘޷͖
  5. ಺༰ʹؔͯ͠ • Kubernetes ʹ͍ͭͯ৮ΕΔ෦෼͕ଟ͍Ͱ͢

  6. γεςϜ֓ཁ

  7. ͦ΋ͦ΋͜Ε͸…? • ݱࡏӡ༻͍ͯ͠Δ CAREER POCKET* ͷத৺తͳσʔλϕʔε • σʔλϕʔεͷϓϩδΣΫτ໊͸ Candicom •

    Candidate (ީิ) + Communication (΍ΓͱΓ) = Candicom • αΠϘ΢ζࣾͷ Kintone Λར༻͍͕ͯͨ͠ 
 ࣾ಺ͷنఆʹΑΓར༻Λଓ͚Δͷ͕೉͘͠ͳͬͨ • ؆୯ͳಡΈॻ͖͢Δ API Λඋ͑ͨɺϛχαΠζͷΫϩʔϯ * CAREER POCKET ʹ͍ͭͯ͸ޙड़
  8. ར༻Πϝʔδ ౤ߘ స৬τʔΫ ཤྺه࿥ Candicom

  9. ػೳ • ϑΟϧλΛ࢖༻ͨ͠Ϧετ • CSV Πϯϙʔτ, ΤΫεϙʔτ • RESTful ͳ

    CRUD API
  10. Kubernetes ͷ׆༻

  11. Kubernetes (k8s) ͱ͸ • Google ͕ઃܭͨ͠ίϯςφΦʔέ ετϨʔγϣϯγεςϜ • ίϯςφΛΫϥελ (ෳ਺ͷϚγϯ

    ͷଋ) ಺Ͱԣஅͯ͠σϓϩΠ, ε έʔϦϯά͢ΔͨΊͷϓϥοτ ϑΥʔϜ Kubernetes - Wikimedia Commons / CC BY 4.0
  12. Πϯϑϥߏ੒

  13. Pros and Cons • Pros ☺ • ಛఆͷίϯϙʔωϯτͷΈͷߋ৽ͷ৔߹ɺӨڹൣғ͕ݶΒΕΔ • εέʔϦϯά,

    Autohealing, ϩΪϯά, ϝτϦΫεऔಘͷԸܙ͕ 
 Kubernetes ʹΑͬͯಘΒΕΔ (ओʹϚωʔδυͳ Kubernetes ͷ৔߹) • Cons • Kubernetes ୯ମͰͷӡ༻͸͸͖ͬΓݴͬͯͭΒ͍ [ཁग़య] • σϓϩΠपΓͳͲ͸ॳظͷஈ֊Ͱؾͮ͘ • ಛʹεςʔτΛ࣋ͭϦιʔε (DB, ΩϟογϡͳͲ) Λ 
 ΫϥελʹࠞͥΔͱ໽հͳଘࡏʹͳΔ
  14. GitHub Actions Ͱͷ CI/CD

  15. Կ΋ߟ͑ͳ͍ͱ٧·Δ • ಛʹ kubectl yaml ؔ࿈ • Q. ࠷৽ͷΠϝʔδΛৗʹ࢖͏Α͏ʹ͢Δʹ͸ʁ •

    ΠϝʔδλάΛมߋ͠ͳ͍ͱ৽͍͠ίϯςφ͕σϓϩΠ͞Εͳ͍ • Ͱ΋ɺ೴ࢮͰ docker pull [image]:latest ͍ͨ͠ • Q. ։ൃ, εςʔδϯά, ঎༻؀ڥͰͷ஋ͷ੾Γସ͑Λߦ͏ʹ͸ʁ • ௕ʑ͍͠ yaml ΛίϐϖࡇΓͨ͘͠ͳ͍ • Q. ൿಗʹ͢΂͖৘ใ͸Ͳ͏΍ͬͯӅ͢ʁ • ྲྀੴʹ؀ڥม਺ʹϕλॻ͖͸ͭΒ͍
  16. ࠷৽ͷΠϝʔδΛৗʹ࢖͍͍ͨ • 1. Skaffold* ͰΠϝʔδͷ Ϗϧυɾϓογϡ • 2. latest λά΋Ϗϧυ͠

    ͨΠϝʔδʹ͚ͭͯ͋͛ ͯϓογϡ͢Δ • 3. Skaffold Ͱ Kubernetes Ϋϥελ΁ͷσϓϩΠ * Skaffold ʹ͍ͭͯ͸ޙड़
  17. Skaffoldͱ͸ • Google Ͱ࡞ΒΕͨ Kubernetes ΁ͷσϓϩΠΛศརʹ͢Δπʔϧ • kubectl, kustomize, helm

    ͳͲΛΑ͠ͳʹ࣮ߦͯ͘͠ΕΔ • ϥούʔ + Ұ෦ಠࣗͷػೳ ͷΑ͏ͳ…
  18. ؀ڥຖʹ஋Λ੾Γସ͍͑ͨ

  19. ൿಗ৘ใΛ͍࣋ͪͨ • Β͘Β͘ίʔε (ඪ४ػೳ) • Ϋϥελ΁ͷ؅ཧݖݶΛ࣋ͬͯΔͱ༨༟ͰσʔλΛݟΔ͜ͱ͕ग़དྷΔ • GCP ͷ؅ཧը໘͔Β Key-Value

    ͷ Key ͸֬ೝՄೳ • ͜ͷϦιʔεࣗମ΋ yaml ͰදݱͰ͖Δ͕ɺ͜ͷํ๏Λ࢖͏৔߹͸ 
 ҙਤతʹ yaml Λॻ͔ͳ͍ํ͕ྑͦ͞͏ɻ (git ʹίϛοτͱ͔ͷՄೳੑ)
  20. ൿಗ৘ใΛ͍࣋ͪͨ • ηΩϡΞίʔε • HashiCorp Vault • جຊతͳ Key-Value ܗࣜͰͷอ؅Ҏ֎ʹɺಈతͳ

    IAM ੜ੒ɺ σʔλͷ༗ޮظݶɺ؂ࠪϩάɺσʔλͷ҉߸Խ/෮߸Խ ͳͲͳͲ ߦ͑Δ • AWS KMS, Cloud KMS, Cloud Secret Manager ͳͲ
  21. ͨͩ͠ • (ͲͷΈͪ) Ϋϥελ, Pod ಺ʹ৵ೖ͞ΕΔͱ͍͘Β IAM Λߜ͍ͬͯͯ ΋Ωπ͍෦෼΋͋Δ (RBAC

    ͷ࢖༻ͰΧόʔग़དྷΔ෦෼΋͋Δ) • ϓϩάϥϜଆ΋ϝϞϦʹೝূ৘ใͳͲΛ࣋ͭ͜ͱʹͳΔͷͰɺϦʔυ ΦϯϦʔίϯςφ & γΣϧΞΫηεണୣͩͬͨΓ͢Δ΂͖ (?) • ͜ͷลΓ͸ GKE ͷυΩϡϝϯτͳͲΛಡΈ·͕࣮ͨ֬͠ͳͷ͸ෆ ໌…
  22. ࠓޙ*ͷվળ఺ ͜ͷล͸ղܾ *ࠓޙͱ͔ॻ͖ͭͭ͜ͷ࿩ͷݩωλ͸ 2020/06 ͘Β͍Ͱ͢…

  23. END