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

DockerとKubernetesでアプリケーション開発にコンテナをフル活用!

stormcat24
November 08, 2018

 DockerとKubernetesでアプリケーション開発にコンテナをフル活用!

11/7開催:DockerとKubernetesでアプリケーション開発にコンテナをフル活用!

http://www.itstaffing.jp/engineer/entry/20181022_2_1

stormcat24

November 08, 2018
Tweet

More Decks by stormcat24

Other Decks in Programming

Transcript

  1. %PDLFSͱ,VCFSOFUFTͰ
    ΞϓϦέʔγϣϯ։ൃʹ
    ίϯςφΛϑϧ׆༻ʂɹ

    "LJOPSJ:BNBEB!TUPSNDBU

    View Slide

  2. 1SPGJMF
    ‣ "LJOPSJ:BNBEB
    ‣ $ZCFS"HFOU *OD
    ‣ '3&4)-*7&UFDIMFBE
    ‣ IUUQTCMPHTUPSNDBUJP
    stormcat24

    View Slide

  3. %PDLFS,VCFSOFUFT
    ࣮ફίϯςφ։ൃೖ໳
    ʢٕज़ධ࿦ࣾʣ

    View Slide

  4. ίϯςφ஌ࣝθϩ͔ΒͰ΋ɺ
    ຊ൪؀ڥͰίϯςφΛ࢖͑Δ·Ͱʹ
    ҰؾʹεΩϧҾ্͖͛ΔຊͰ͢

    View Slide

  5. )FBEMJOF
    ‣ %PDLFSͱ͸ʁίϯςφͱ͸ʁ
    ‣ %PDLFSΛମݧ͢Δ
    ‣ %PDLFSϑϨϯυϦͳΠϝʔδΛͭ͘Δ
    ‣ ίϯςφΦʔέετϨʔγϣϯͱ͸ʁ
    ‣ ,VCFSOFUFTͰͷ࣮ફతͳΞϓϦέʔγϣϯ։ൃ
    ‣ ύϒϦοΫΫϥ΢υͰͷίϯςφӡ༻
    ‣ ίϯςφͷӡ༻Λࢧ͑Δπʔϧ

    View Slide

  6. %PDLFSͱ͸ʁ
    ίϯςφͱ͸ʁ

    View Slide

  7. %PDLFS΍ίϯςφʹͲͷΑ͏ͳ
    ҹ৅Λ͍࣋ͬͯ·͔͢ʁ

    View Slide

  8. %PDLFSʁίϯςφʁ
    Ծ૝؀ڥʁ Πϯϑϥ
    ٕज़ʁ
    ܰྔʁ ࢖͍ॴ͸ʁ
    ։ൃ؀ڥ
    ޲͚ʁ

    View Slide

  9. %PDLFSͱ͸
    ‣ ίϯςφܕԾ૷ٕज़Λ࣮ݱ͢ΔͨΊͷৗறΞϓϦέʔγϣϯͱ
    ίϚϯυϥΠϯπʔϧ͔Β੒ΔϓϩμΫτ
    ‣ Πϯϑϥٕज़ͱ͍͏ΑΓ͸ɺΞϓϦέʔγϣϯͷσϓϩΠʹಛ
    Խٕͨ͠ज़
    ‣ ೥ɺ4PMPNPO)ZLFT͕044ͱͯ͠ެ։
    ‣ Ҏޙɺ%PDLFSࣾ΍ίϛϡχςΟΛத৺ʹ༷ʑͳπʔϧ΍Τίγ
    εςϜ͕։ൃɺίϯςφٕज़ͷΦʔϓϯԽ͕ਐΊΒΕ͍ͯΔ

    View Slide

  10. ୅දతͳԾ૝Խٕज़
    ϗετ04ܕ
    Ծ૝Խٕज़
    ίϯςφܕ
    Ծ૝Խٕज़

    View Slide

  11. Ծ૝Խٕज़ͷҧ͍

    View Slide

  12. ϗετܕԾ૝Խٕज़ͷಛ௃
    ‣ ϗετܕԾ૝ԽͰ͸ɺԾ૝Խιϑτ΢ΣΞΛར༻͠ɺϋʔυ΢Σ
    ΞΛ$16ԋࢉʹΑͬͯ࠶ݱ͠ɺήετ04Λ࡞Γग़͢
    ‣ Ծ૝04ͷ࠶ݱ౓͕ߴ͍෼ɺىಈॲཧ౳ͷΦʔόʔϔου͕େ͖
    ͘ͳΔ
    ‣ 7.XBSF1MBZFS 0SBDMF7JSUVBM#PY౳

    View Slide

  13. ίϯςφܕԾ૝Խٕज़ͷಛ௃
    ‣ ϗετܕͱ͸ҧ͍ɺίϯςφ͸ϗετ04ͷΧʔωϧϦιʔεΛ
    ڞ༗ͯ͠ར༻
    ‣ ιϑτ΢ΣΞແ͠Ͱɺ04ͷϦιʔεΛ࿦ཧతʹԾ૝04ʢίϯς
    φʣͱִͯ͠཭͢Δ
    ‣ ίϯςφܕͰ͸ɺԾ૝04͸04ͷશͯͷػೳΛ࠶ݱ͢ΔΘ͚Ͱ͸
    ͳ͍ͨΊɺͦͷ෼ϗετܕΑΓΦʔόʔϔου͕খ͍͞
    ‣ %PDLFSҎલ͸-9$ -JOVY$POUBJOFST
    ͕༗໊

    View Slide

  14. %PDLFSͷԾ૝ԽΞʔΩςΫνϟͷมભ

    View Slide

  15. %PDLFSΛԿʹ࢖͏ʁ

    View Slide

  16. %PDLFSΞϓϦέʔγϣϯͷ
    σϓϩΠʹಛԽٕͨ͠ज़

    View Slide

  17. ΞϓϦέʔγϣϯͷσϓϩΠʹಛԽͨ͠ಛ௃
    ‣ ϗετʹࠨӈ͞Εͳ͍࣮ߦ؀ڥɺ؀ڥࠩҟ໰୊͔Βͷ୤٫
    ‣ %PDLFSGJMFͰͷίϯςφߏ੒ɾΞϓϦέʔγϣϯ഑ஔఆٛ
    ‣ Πϝʔδͷόʔδϣϯ؅ཧ
    ‣ ࠩ෼Ϗϧυ͕ՄೳͳϨΠϠʔߏ଄Λ࣋ͭΠϝʔδϑΥʔϚοτ
    ‣ %PDLFSϨδετϦʢΠϝʔδͷอ؅αʔόʣ
    ‣ ϓϩάϥϚϒϧͳ֤छ"1*
    ˞-9$͸ܰྔ͕ͩɺ͜ͷ؍఺͕͚͍ܽͯΔ

    View Slide

  18. ༏ΕͨϙʔλϏϦςΟ
    MPDBM
    EFWFMPQNFOU
    TUBHJOH
    QSPEVDUJPO
    %PDLFS͕Πϯετʔϧ͞Ε͍ͯΕ͹ɺ
    ಉ͡Πϝʔδ͔Β࡞ΒΕΔίϯςφΛଞͷϗετͰ༰қʹ࣮ߦͰ͖Δ

    View Slide

  19. ϙʔλϏϦςΟ͕΋ͨΒͨ͠΋ͷ
    ‣ ίϯςφʹΑͬͯɺήετ04ͱΞϓϦέʔγϣϯΛηοτͰΠ
    ϝʔδͱͯ͠ύοέʔδϯάͰ͖Δ
    ‣ %PDLFSίϯςφʹΑΔ؀ڥͷ࠶ݱੑ
    ‣ ΠϯϑϥͷଘࡏΛʢ͋·ΓʣؾʹͤͣʹσϓϩΠͰ͖Δ
    %PDLFSΛϑϧ׆༻ͨ͠։ൃͷྲྀߦ

    View Slide

  20. %PDLFSΛମݧ͢Δ

    View Slide

  21. ؀ڥߏங

    View Slide

  22. ϩʔΧϧͰͷ%PDLFS؀ڥߏங
    ‣ %PDLFS%FTLUPQ
    ‣ IUUQTXXXEPDLFSDPNQSPEVDUTEPDLFSEFTLUPQ

    View Slide

  23. ϩʔΧϧͰͷ%PDLFS؀ڥߏங

    View Slide

  24. ϩʔΧϧͰͷ%PDLFS؀ڥߏங
    EPDLFSWFSTJPO
    $MJFOU
    7FSTJPODF
    "1*WFSTJPO
    (PWFSTJPOHP
    (JUDPNNJU⒎B
    #VJMU8FE+VM
    04"SDIEBSXJOBNE
    &YQFSJNFOUBMGBMTF
    4FSWFS
    &OHJOF
    7FSTJPODF
    "1*WFSTJPO NJOJNVNWFSTJPO

    (PWFSTJPOHP
    (JUDPNNJU⒎B
    #VJMU8FE+VM
    04"SDIMJOVYBNE

    View Slide

  25. %PDLFSΠϝʔδΛऔಘ͠ɺ
    %PDLFSίϯςφΛ࣮ߦ͢Δ

    View Slide

  26. Πϝʔδͱίϯςφͷҧ͍
    ‣ %PDLFSΠϝʔδ
    ‣ %PDLFSίϯςφΛߏ੒͢ΔϑΝΠϧγεςϜ΍ɺ࣮ߦ͢ΔΞ
    ϓϦέʔγϣϯ΍ઃఆΛ·ͱΊͨ΋ͷ
    ‣ ίϯςφΛ࡞੒͢ΔͨΊʹར༻͞ΕΔςϯϓϨʔτͱͳΔ
    ‣ %PDLFSίϯςφ
    ‣ %PDLFSΠϝʔδΛجʹ࡞੒͞Εɺ۩ݱԽ͞ΕͨϑΝΠϧγε
    ςϜͱΞϓϦέʔγϣϯ͕࣮ߦ͞Ε͍ͯΔঢ়ଶ

    View Slide

  27. Πϝʔδͱίϯςφͷҧ͍

    View Slide

  28. FDIPίϯςφΛ࣮ߦ͢Δ
    ‣ HJIZPEPDLFSFDIPMBUFTUͱ͍͏Πϝʔδ͔ΒίϯςφΛ࣮ߦ
    ‣ ͜ͷΠϝʔδ͸%PDLFS)VCʹอ࣋͞Ε͍ͯΔ
    ‣ (&5ϦΫΤετΛ౤͛Δͱʮ)FMMP%PDLFSʯΛฦ͢
    Demo-1

    View Slide

  29. FDIPίϯςφΛ࣮ߦ͢Δ
    Demo-1
    %PDLFSΠϝʔδͷμ΢ϯϩʔυ
    EPDLFSJNBHFQVMMHJIZPEPDLFSFDIPMBUFTU
    %PDLFSίϯςφͷ࣮ߦ
    EPDLFSDPOUBJOFSSVOJUQHJIZPEPDLFSFDIPMBUFTU
    ϗετOS
    echoίϯςφ
    Port 8080
    Port 9000
    ϙʔτϑΥϫʔυ
    HTTP GET

    View Slide

  30. FDIPίϯςφΛ࣮ߦ͢Δ
    Demo-1
    ϑΥΞάϥ΢ϯυͰͷ࣮ߦ
    EPDLFSDPOUBJOFSSVOJUQHJIZPEPDLFSFDIPMBUFTU
    TUBSUTFSWFS
    SFDFJWFESFRVFTU
    όοΫάϥ΢ϯυͰͷ࣮ߦ
    EPDLFSDPOUBJOFSSVOEQHJIZPEPDLFSFDIPMBUFTU
    GEGGBBFCEʜ
    "1*΍8FCΞϓϦέʔγϣϯͰ͸ɺόοΫάϥ΢ϯυͰ࣮ߦ͢Δ

    View Slide

  31. %PDLFSΠϝʔδΛϏϧυ͢Δ

    View Slide

  32. %PDLFSGJMF
    ‣ '30.ϕʔεͱ͢ΔΠϝʔδΛܾఆ͢Δ
    ‣ $01:ϗετ͔ΒίϯςφʹϑΝΠϧΛίϐʔ͢Δ
    ‣ 36/ίϯςφ಺Ͱ೚ҙͷॲཧΛ࣮ߦ͢Δ
    ‣ $.%Πϝʔδ͔ΒίϯςφΛ࡞੒͢ΔࡍʹɺίϯςφͰ࣮ߦ
    ͢ΔϝΠϯϓϩηεΛઃఆ͢Δ

    View Slide

  33. %PDLFSΠϝʔδΛϏϧυ͢Δ
    Demo-2
    USFF

    ᵓᴷᴷ%PDLFSpMF
    ᵋᴷᴷIFMMPXPSME
    EJSFDUPSJFT pMFT
    IFMMPXPSMEεΫϦϓτΛίϯςφͰ࣮ߦ͢ΔͨΊͷΠϝʔδΛͭ͘Δ

    View Slide

  34. %PDLFSΠϝʔδΛϏϧυ͢Δ
    Demo-2
    '30.VCVOUV
    $01:IFMMPXPSMEVTSMPDBMCJO
    36/DINPEYVTSMPDBMCJOIFMMPXPSME
    $.%<IFMMPXPSME>

    View Slide

  35. %PDLFSΠϝʔδΛϏϧυ͢Δ
    Demo-2
    IFMMPXPSMEMBUFTUͱ͍͏໊લͰΠϝʔδΛϏϧυ
    EPDLFSJNBHFCVJMEUIFMMPXPSMEMBUFTU

    3FNPWJOHJOUFSNFEJBUFDPOUBJOFSDEBB
    DGBF
    4VDDFTTGVMMZCVJMUDGBF
    4VDDFTTGVMMZUBHHFEIFMMPXPSMEMBUFTU
    ࡞੒ͨ͠ΠϝʔδΛ֬ೝ
    EPDLFSJNBHFMTcHSFQIFMMPXPSME
    IFMMPXPSMEMBUFTUDGBFNJOVUFTBHP.#

    View Slide

  36. Πϝʔδ͔ΒίϯςφΛ࣮ߦ
    Demo-2
    ࡞੒ͨ͠Πϝʔδ͔ΒίϯςφΛ࣮ߦ
    EPDLFSDPOUBJOFSSVOIFMMPXPSMEMBUFTU
    )FMMP 8PSME
    IFMMPXPSMEεΫϦϓτ͕ίϯςφͰ࣮ߦ
    εΫϦϓτ͕ऴྃ͢Δͱίϯςφ΋ऴྃ͢Δ

    View Slide

  37. %PDLFSϑϨϯυϦͳ
    ΠϝʔδΛͭ͘Δ

    View Slide

  38. ˞͓͞Β͍
    %PDLFS͸༏ΕͨϙʔλϏϦςΟΛ࣋ͭ

    View Slide

  39. ίϯςφ͸ෳ੡͠΍͍͕͢ɾɾɾ
    EFWFMPQNFOU TUBHJOH QSPEVDUJPO
    ࣮ࡍʹ͸ΞϓϦέʔγϣϯͷڍಈ͸
    σϓϩΠ͢Δ؀ڥʹΑ੍ͬͯޚ͢Δඞཁ͕͋Δ
    FHσʔλϕʔεͷ઀ଓઌ
    FHΞϓϦέʔγϣϯ͕ར༻͢Δ"1*ͷϗετ

    View Slide

  40. ίϯςφͷڍಈΛઃఆͰ੍ޚ͢Δ

    View Slide

  41. ઃఆΛίϯςφʹ౉͢ํ๏
    ‣ ࣮ߦ࣌ͷҾ਺
    ‣ ઃఆ͕ଟ͍৔߹ɺऔΓճ͠ʹ͍͘
    ‣ ΞϓϦέʔγϣϯͷ؀ڥผઃఆϑΝΠϧ
    ‣ EFWFMPQ TUBHJOH QSPEVDUJPOผͷઃఆϑΝΠϧΛؚΊΔ
    ‣ ؀ڥ͕૿͑Δ৔߹ɺΞϓϦέʔγϣϯʴΠϝʔδͷϏϧυ͕ඞཁ
    ‣ ؀ڥม਺
    ‣ ࠷΋Ԧಓͷख๏

    View Slide

  42. ؀ڥม਺੍ޚͷྑ͞
    ‣ ؀ڥผઃఆϑΝΠϧͱҧ͍ɺ؀ڥ௥Ճͷ৔߹ʹઃఆϑΝΠϧΛ
    ௥Ճͯ͠Ϗϧυ͢Δඞཁ͕ແ͍
    ‣ ؀ڥม਺୯ҐͰ੍ޚͰ͖ΔͷͰখճΓ͕ޮ͘
    ‣ FH%#ͷίωΫγϣϯϓʔϧαΠζ͚ͩΛมߋ͢Δ
    ‣ τϥΠΞϯυΤϥʔͷ͠΍͢͞

    View Slide

  43. ؀ڥม਺Λ׆༻͢Δ
    %PDLFSϑϨϯυϦͳ
    Πϝʔδ࡞੒ʹܨ͕Δ

    View Slide

  44. FH4QSJOHͷQSPQFSUJFTϑΝΠϧ
    ECESJWFS$MBTT\%#@%3*7&[email protected]$-"44DPNNZTRMKECD%SJWFS^
    ECKECD6SM\%#@+%#[email protected]^
    ECVTFS\%#@64&3^
    ECQBTTXPSE\%#@1"44803%^
    ECJOJUJBM4J[F\%#@*/*5*"[email protected]*;&^
    ECNBY"DUJWF\%#@."[email protected]"$5*7&^
    ECNBY*EMF\%#@."[email protected]*%-&^
    ECNJO*EMF\%#@.*/@*%-&^
    ΞϓϦέʔγϣϯ͸؀ڥม਺ΛऔΕΔ࡞Γʹ͢Δ͜ͱ͕ॏཁʂ

    View Slide

  45. ίϯςφΦʔέετϨʔγϣϯ
    ͱ͸ʁ

    View Slide

  46. ίϯςφͰγεςϜΛߏங͢Δ
    ଟ͘ͷίϯςφΛσϓϩΠͰ͖Δ
    ଟ͘ͷ%PDLFSϗετ͕ඞཁ

    View Slide

  47. ίϯςφͷ഑ஔ͸೉͍͠
    ‣ ͲͷछྨͷίϯςφΛͲͷΑ͏ʹ഑ஔ͢Δ͔ʁ
    ‣ ϗετͷϚγϯϦιʔεΛޮ཰తʹ࢖͏഑ஔ͸Ͳ͏ͳΔ͔ʁ
    ‣ ίϯςφ΁ͷΞΫηεܦ࿏ΛͲ͏ܾΊΔ͔ʁ
    ‣ εέʔϧΞ΢τΠϯΛͲͷΑ͏ʹߦ͏͔ʁ
    %PDLFS)PTU %PDLFS)PTU %PDLFS)PTU %PDLFS)PTU
    #
    &
    "
    %
    #
    &
    $
    %
    &
    " $
    %

    View Slide

  48. ਓ͕ؒߟ͑Δ͜ͱ͡Όͳ͍

    View Slide

  49. ෳ਺ͷϗετΛލ͗
    ෳ਺छͷίϯςφΛໃ६ͷແ͍ܗͰ
    αʔόϦιʔεΛߟྀ͠ޮ཰తʹ഑ஔ͢Δ
    ίϯςφΦʔέετϨʔγϣϯٕज़

    View Slide

  50. ୅දతͳίϯςφΦʔέετϨʔγϣϯٕज़
    ‣ %PDLFS$PNQPTF
    ‣ %PDLFS4XBSN4UBDL
    ‣ ,VCFSOFUFT
    ‣ "QBDIF.FTPT
    ‣ "NB[PO&$$POUBJOFS4FSWJDFT &$4

    View Slide

  51. σϑΝΫτελϯμʔυ͸
    ,VCFSOFUFT

    View Slide

  52. ,VCFSOFUFTͰͷ
    ࣮ફతͳΞϓϦέʔγϣϯ։ൃ

    View Slide

  53. ,VCFSOFUFTͱ͸ʁ
    ‣ ΫόωςΟεɺΫʔϕϧωΟςΟε౳ͱಡΉ
    ‣ ུশ͸LVCF΍LT
    ‣ (PPHMFࣾ಺ͷίϯςφج൫͔Β೿ੜ
    ‣ 044ͷίϯςφΦʔέετϨʔγϣϯγεςϜ
    ‣ ༷ʑͳϓϥοτϑΥʔϜʹରԠͰߴػೳ
    ‣ ίϯςφͷ഑ஔ΍ɺϧʔςΟϯάͷܾఆ౳Λ͍͍ײ͡ʹ΍ͬͯ
    ͘ΕΔ

    View Slide

  54. ϩʔΧϧ؀ڥߏங
    %PDLFS%FTLUPQͷ,VCFSOFUFT౷߹Λ༗ޮʹ͢Δ

    View Slide

  55. LVCFDUM
    ‣ ,VCFSOFUFTΫϥελͷϦιʔεΛૢ࡞ɾӾཡ͢ΔͨΊͷίϚϯ
    υϥΠϯπʔϧ
    ‣ %PDLFS%FTLUPQͷ,VCFSOFUFT౷߹Λ༗ޮʹ͢ΔͱɺࣗಈͰΠ
    ϯετʔϧ͞ΕΔ

    View Slide

  56. ,VCFSOFUFTͷϦιʔε

    View Slide

  57. Ϧιʔεͱ͸ʁ
    ‣ ,VCFSOFUFTʹ͓͍ͯɺΞϓϦέʔγϣϯͷσϓϩΠΛ࣮ݱ͢Δ
    ͨΊʹඞཁͳ෦඼ͷΑ͏ͳ΋ͷ
    ‣ ࣮ߦ͞ΕΔΞϓϦέʔγϣϯ͸༷ʑͳϦιʔεͱڠௐ͢Δ͜ͱ
    ͰɺγεςϜͱͯ͠ಈ࡞͢Δ

    View Slide

  58. %FQMPZNFOU
    /BNFTQBDF 4FSWJDF *OHSFTT
    $POGJH.BQ
    %BFNPO4FU
    4UBUFGVM4FU +PC
    1PE 3FQMJDB4FU
    +PC $SPO+PC
    ,VCFSOFUFTͷϦιʔεͨͪ

    View Slide

  59. %FQMPZNFOU
    /BNFTQBDF 4FSWJDF *OHSFTT
    $POGJH.BQ
    %BFNPO4FU
    4UBUFGVM4FU +PC
    1PE 3FQMJDB4FU
    +PC $SPO+PC
    ,VCFSOFUFTͷϦιʔεͨͪ
    ࠓ೔͸͜ͷͭΛ঺հ͠·͢

    View Slide

  60. 1PE

    View Slide

  61. 1PE
    ‣ ίϯςφͷू߹ମͷ୯ҐͰɺগͳ͘ͱ΋ͭͷίϯςφΛ࣋ͭ
    ‣ ίϯςφಉ͕࢜ີ݁߹Ͱ͋Δํ͕౎߹͕ྑ͍৔߹ɺ1PEͱͯ͠
    ෳ਺छίϯςφΛ·ͱΊͯσϓϩΠ͢Δ
    ‣ ,VCFSOFUFTͰ͸ίϯςφ୯ҐͰ͸ͳ͘ɺ1PE୯ҐͰσϓϩΠ͞
    ΕΔ

    View Slide

  62. 1PE

    View Slide

  63. 1PEͷ഑ஔΠϝʔδ

    View Slide

  64. /PEFލ͗͸/(
    1PEͰάϧʔϐϯά͞Εͨίϯςφ͸
    ಉ͡/PEFʹ഑ஔ͞ΕΔ

    View Slide

  65. 1PEΛσϓϩΠ͢Δ
    Demo-3
    apiVersion: v1
    kind: Pod
    metadata:
    name: simple-echo
    spec:
    containers:
    - name: nginx
    image: gihyodocker/nginx-proxy:latest
    env:
    - name: BACKEND_HOST
    value: localhost:8080
    ports:
    - containerPort: 80
    - name: echo
    image: gihyodocker/echo:latest
    ports:
    - containerPort: 8080
    /HJOYͱFDIPΞϓϦέʔγϣϯͰߏ੒͞ΕΔ1PEΛσϓϩΠ͢Δ

    View Slide

  66. ଞͷίϯςφ͸Ͳ͏ࢀর͢Δ͔ʁ
    Demo-3
    1PEࣗ਎͕ͭͷԾ૝ϚγϯͷΑ͏ͳ΋ͷ
    FDIPίϯςφͷϙʔτ͸ɺ
    OHJOY͔Β͸MPDBMIPTUͱݟ͑Δ

    View Slide

  67. 1PEΛσϓϩΠ͢Δ
    Demo-3
    ϚχϑΣετϑΝΠϧΛɺ,VCFSOFUFTΫϥελʹద༻͢Δ
    LVCFDUMBQQMZGTJNQMFQPEZBNM
    ࡞੒ͨ͠1PEΛ֬ೝ͢Δ
    LVCFDUMHFUQPE
    ࡞੒ͨ͠1PEͷϩάΛ֬ೝ͢Δ
    LVCFDUMMPHTGTJNQMFFDIPDFDIP
    ࡞੒ͨ͠1PEͷίϯςφͷதʹೖΔɹ
    LVCFDUMFYFDJUTJNQMFFDIPTIDOHJOY

    View Slide

  68. %FQMPZNFOU

    View Slide

  69. %FQMPZNFOU
    ‣ 1PE͸ͭͷϚχϑΣετϑΝΠϧʹ͖͔ͭͭ͠࡞੒Ͱ͖ͳ͍
    ‣ ࣮ӡ༻Ͱ͸ɺಉ͡1PEΛେྔʹෳ੡͢Δ͜ͱͰՄ༻ੑΛߴΊΔ
    ‣ 3FQMJDB4FUͰ1PEͷෳ੡͕Ͱ͖Δ͕ɺ%FQMPZNFOU͸3FQMJDB4FU
    Λੈ୅؅ཧͰ͖ΔͨΊɺϩʔϧόοΫ΋Մೳ
    ‣ جຊతʹɺ1PE΍3FQMJDB4FUͷϚχϑΣετͰ͸ͳ͘
    %FQMPZNFOUͷϚχϑΣετϑΝΠϧΛ࡞੒͢Δͱߟ͑ͯ0,

    View Slide

  70. %FQMPZNFOUͱͷؔ࿈

    View Slide

  71. %FQMPZNFOUͷ࡞੒
    Demo-4
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: echo
    labels:
    app: echo
    spec:
    replicas: 3
    selector:
    matchLabels:
    app: echo
    template:
    metadata:
    labels:
    app: echo
    spec:
    containers:
    - name: nginx
    image: gihyodocker/nginx:latest
    env:
    - name: BACKEND_HOST
    value: localhost:8080
    ports:
    - containerPort: 80
    - name: echo
    image: gihyodocker/echo:latest
    ports:
    - containerPort: 8080
    ˡUFNQMBUFҎԼ͸ɺઌఔͷ1PEఆٛͱಉ͡

    View Slide

  72. %FQMPZNFOUΛ࡞੒͢Δ
    Demo-4
    ϚχϑΣετϑΝΠϧΛɺ,VCFSOFUFTΫϥελʹద༻͢Δ
    LVCFDUMBQQMZGTJNQMFEFQMPZNFOUZBNM
    ࡞੒ͨ͠%FQMPZNFOUΛ֬ೝ͢Δ
    LVCFDUMHFUEFQMPZNFOUTFMFDUPSBQQFDIP
    1PE͕ෳ਺ੜ੒͞Ε͍ͯΔ͔Λ֬ೝ͢Δ
    LVCFDUMHFUQPETFMFDUPSBQQFDIP

    View Slide

  73. 4FSWJDF

    View Slide

  74. 4FSWJDF
    ‣ 1PEͷू߹ʹର͢ΔϧʔςΟϯά΍αʔϏεσΟεΧόϦػೳ
    Λఏڙ͢ΔϦιʔε
    ‣ ಉ͡छྨͷෳ਺1PEʹର͠ɺτϥϑΟοΫΛྲྀͨ͢Ίͷϩʔυ
    όϥϯαʔͱͯ͠ͷػೳ΋࣋ͭ
    ‣ 4FSWJDF͔ΒͷτϥϑΟοΫͷసૹ͸ɺઃఆ͞ΕͨTFMFDUPSTͷ
    ϥϕϧͷ஋ʹΑܾͬͯఆ͞ΕΔ
    ‣ ,VCFSOFUFTΫϥελ಺෦Ͱ͸ɺ4FSWJDFͷ໊લͰ4FSWJDFʹ໊લ
    ղܾͰ͖Δ

    View Slide

  75. 4FSWJDFʹΑΔ1PEͷݟ͚ͭํ

    View Slide

  76. 4FSWJDFͷϚχϑΣετ
    Demo-5
    apiVersion: v1
    kind: Service
    metadata:
    name: echo
    spec:
    selector:
    app: echo
    release: summer
    ports:
    - name: http
    port: 80
    ˡTFMFDUPSͰఆٛͨ͠ϥϕϧʹ
    Ϛον͢Δ1PEʹτϥϑΟοΫΛྲྀ͢

    View Slide

  77. 4FSWJDFΛ࡞੒͢Δ
    Demo-5
    ϚχϑΣετϑΝΠϧΛɺ,VCFSOFUFTΫϥελʹద༻͢Δ
    LVCFDUMBQQMZGTJNQMFTFSWJDFZBNM
    ࡞੒ͨ͠4FSWJDFΛ֬ೝ͢Δ
    LVCFDUMHFUTWDFDIP
    σόοά༻ͷ1PEΛ࡞Γɺ͔ͦ͜Β࡞੒ͨ͠4FSWJDFʹରͯ͠)551ϦΫΤετ
    LVCFDUMSVOJSNUUZEFCVHJNBHFHJIZPEPDLFSGVOEBNFOUBM
    SFTUBSU/FWFSCBTIJM

    View Slide

  78. *OHSFTT

    View Slide

  79. *OHSFTT
    ‣ 4FSWJDF͸Ϋϥελ಺෦͔Β͔͠ΞΫηεͰ͖ͳ͍
    ‣ 4FSWJDF͸Ϋϥελ֎෦΁ެ։͢ΔͨΊͷϦιʔε͕*OHSFTT
    ‣ 8FCΞϓϦέʔγϣϯ΍"1*ΞϓϦέʔγϣϯΛΠϯλʔωο
    τʹެ։͢Δ৔߹ඞཁ

    View Slide

  80. *OHSFTTͷϚχϑΣετ
    Demo-6
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    name: echo
    spec:
    rules:
    - host: echo.gihyo.local
    http:
    paths:
    - path: /
    backend:
    serviceName: echo
    servicePort: 80
    ˡެ։͢Δ4FSWJDF
    ˡެ։͢ΔυϝΠϯ
    ʢ7JSUVBM)PTUʣ

    View Slide

  81. *OHSFTTΛ࡞੒͢Δ
    Demo-6
    ϚχϑΣετϑΝΠϧΛɺ,VCFSOFUFTΫϥελʹద༻͢Δ
    LVCFDUMBQQMZGTJNQMFJOHSFTTZBNM
    ࡞੒ͨ͠*OHSFTTΛ֬ೝ͢Δ
    LVCFDUMHFUJOHSFTT
    Ϋϥελ֎ʢϩʔΧϧʣ͔Βɺެ։͍ͯ͠Δ*OHSFTTʹରͯ͠ϦΫΤετΛૹΔɹ
    DVSMIUUQMPDBMIPTU))PTUFDIPHJIZPMPDBM`

    View Slide

  82. ͜͜·Ͱ͕Ұ௨ΓͷྲྀΕ
    ‣ 4FSWJDF΍*OHSFTT͸Ұ౓࡞ͬͯ͠·͑͹ɺมߋ͕ͳ͍ݶΓͦͷ
    ··
    ‣ ܁Γฦ͠σϓϩΠ͢Δ৔߹͸ɺ%FQMPZNFOUʹߋ৽Λ͔͚ɺ৽͠
    ͍ੈ୅ͷ3FQMJDB4FUͱ1PE͕࡞ΒΕΔ
    ‣ *OHSFTT4FSWJDF%FQMPZNFOU౳ͷϚχϑΣετΛύοέʔδϯ
    ά͠ɺҰׅͰσϓϩΠ͢Δ)FMNͱ͍͏πʔϧ΋͋Δ

    View Slide

  83. ࢀߟɿΑΓ࣮ફతͳߏ੒

    View Slide

  84. ύϒϦοΫΫϥ΢υͰͷ
    ίϯςφӡ༻

    View Slide

  85. ,VCFSOFUFTΛθϩ͔Βߏங͠
    ӡ༻͢Δͷ͸ͱͯ΋େมͰ͢

    View Slide

  86. .BTUFS/PEF,VCFSOFUFTΫϥελશମͷ੍ޚ΍"1*Λఏڙ͢Δαʔό
    /PEF։ൃऀ͕σϓϩΠ͢Δ1PE౳ͷϦιʔε͕഑ஔ͞ΕΔαʔό

    View Slide

  87. ӡ༻ʹඞཁͳ࡞ۀΞϨίϨ
    ‣ ,VCFSOFUFTΫϥελͷߏங࡞ۀ
    ‣ LVCFTQSBZ LPQT౳ͷπʔϧ͕͋Δ͕ɺͦΕͰ΋؆୯Ͱ͸ͳ͍
    ‣ Ϛελʔϊʔυͷ؅ཧ͕ඞཁ
    ‣ ,VCFSOFUFTΫϥελͷόʔδϣϯΞοϓ࡞ۀ
    ‣ *OHSFTT$POUSPMMFS΍"VUPTDBMJOH౳ɺӡ༻ʹඞཁͳ࢓૊ΈΛηο
    τΞοϓ͢Δඞཁ͕͋Δ
    ‣ ϞχλϦϯά΋ࣗલͰηοτΞοϓ

    View Slide

  88. ,VCFSOFUFT
    ϚωʔδυαʔϏεΛ࢖͓͏

    View Slide

  89. ୅දతͳϚωʔδυαʔϏε
    ‣ (PPHMF,VCFSOFUFT&OHJOF (,&

    ‣ "NB[PO&MBTUJD$POUBJOFS4FSWJDFGPS,VCFSOFUFT &,4

    ‣ ౦ژϦʔδϣϯ͸·ͩະରԠ
    ‣ LTͰ͸ͳ͍ίϯςφϚωʔδυαʔϏε &$4
    ΋͋Δ
    ‣ "[VSF,VCFSOFUFT4FSWJDF ",4

    View Slide

  90. ϚωʔδυαʔϏεͷྑ͍ͱ͜Ζ
    ‣ ,VCFSOFUFTΫϥελߏங͕ࣗಈ
    ‣ Ϛελʔϊʔυͷ؅ཧ͕ෆཁ
    ‣ ΫϥελͷόʔδϣϯΞοϓ΋͓·͔ͤ
    ‣ ϓϥοτϑΥʔϜผͷαʔϏεͱɺ਌࿨ੑͷߴ͍࿈ܞ͕Ͱ͖Δ
    ‣ *OHSFTT΍ϩʔυόϥϯαʔͱͷ࿈ܞ౳ɹ
    ‣ "VUPTDBMJOHͰͷϊʔυ૿ݮʹ΋΋ͪΖΜରԠ
    ‣ ϩάͷӾཡ΍ϞχλϦϯάʹରԠ
    ‣ ։ൃऀʹͱͬͯຊ࣭తͰͳ͍࡞ۀ͸Ϛωʔδυ͕୅ߦ

    View Slide

  91. (,&Ͱͷ؅ཧը໘

    View Slide

  92. Ϛωʔδυͷબ୒͸(,&͕ݱ࣮త
    ‣ LT։ൃΛओಋ͢Δ(PPHMFʹΑΔϚωʔδυαʔϏεͰ͋Δ
    ‣ ",4΍&,4͸(,&ʹൺ΂ɺ΍΍஗ΕΛऔ͍ͬͯΔ෦෼͕ଟ͍
    ‣ ػೳ໘΍؅ཧը໘ͷૢ࡞ੑ౳ɹ
    ‣ ಛघͳཧ༝͕ͳ͍ݶΓɺ(,&Λબ୒͢Δ͜ͱΛ͓͢͢Ί͠·͢

    View Slide

  93. ίϯςφӡ༻Λࢧ͑Δπʔϧ

    View Slide

  94. ίϯςφӡ༻Λࢧ͑Δπʔϧ
    ‣ &MBTUJDTFBSDI,JCBOB
    ‣ TUBDLESJWFS
    ‣ TUFSO

    View Slide

  95. &MBTUJDTFBSDI,JCBOB
    ‣ &MBTUJDTFBSDI
    ‣ શจݕࡧΤϯδϯ
    ‣ ίϯςφͷϩάΛอଘ͢ΔͨΊʹར༻
    ‣ ,JCBOB
    ‣ ϩάσʔλՄࢹԽπʔϧ
    ‣ &MBTUJDTFBSDIʹอ࣋͞ΕͨϩάσʔλΛӾཡͰ͖Δ

    View Slide

  96. ϩάऩूͷ࢓૊Έ

    View Slide

  97. LJCBOBͰϩάӾཡ

    View Slide

  98. TUBDLESJWFSͰͷϩά֬ೝ

    View Slide

  99. TUFSO
    ‣ ίϚϯυϥΠϯͰɺ,VCFSOFUFTͷ1PE͕ग़ྗ͢ΔϩάΛUBJM͢
    ΔͨΊͷπʔϧ
    ‣ IUUQTHJUIVCDPNXFSDLFSTUFSO
    ‣ ࢦఆͨ͠ϥϕϧʹώοτ͢Δ1PEͷϩάʹߜΓࠐΊΔ

    View Slide

  100. ·ͱΊ

    View Slide

  101. ·ͱΊ
    ‣ %PDLFS͸ܾͯ͠ΠϯϑϥدΓͷٕज़Ͱ͸ͳ͘ɺΞϓϦέʔγϣ
    ϯͷσϓϩΠʹಛԽٕͨ͠ज़
    ‣ ϙʔλϏϦςΟʹຬͪͨɺ%PDLFSϑϨϯυϦͳΠϝʔδΛͭ͘
    Δ͜ͱʹՁ஋͕͋Δ
    ‣ ༷ʑͳ,VCFSOFUFTϦιʔεΛ૊Έ߹ΘͤͯɺΞϓϦέʔγϣϯ
    ΛσϓϩΠ͢Δ
    ‣ ϚωʔδυαʔϏεʹཔΖ͏ʂʢಛʹཧ༝͕ͳ͚Ε͹(,&ʣ
    ‣ ίϯςφ։ൃΛࢧԉ͢Δɺ༷ʑͳπʔϧ͕ॆ࣮͍ͯ͠·͢

    View Slide

  102. 5IBOLT✋

    View Slide