Slide 1

Slide 1 text

,VCFSOFUFTΛ஌Δ !QFUJUWJPMFU

Slide 2

Slide 2 text

"HFOEB w LVCFSOFUFTͱ͸ w ֓೦ɾ༻ޠ w ΞʔΩςΫνϟ w جຊૢ࡞ w ӡ༻ʹ޲͚ͯ

Slide 3

Slide 3 text

LVCFSOFUFT

Slide 4

Slide 4 text

LVCFSOFUFTͷಡΈํ ͘ʔ͹Ͷ͍ͯ͌͢ ͘ʔ΂ΔͶ͍ͯ͌͢ ͖Ύʔ͹Ͷ͍ͯ͌͢ ͖Ύʔ΂ΔͶ͍ͯ͌͢

Slide 5

Slide 5 text

LVCFSOFUFTJP

Slide 6

Slide 6 text

LVCFSOFUFT *UHSPVQTDPOUBJOFSTUIBUNBLFVQBOBQQMJDBUJPOJOUP MPHJDBMVOJUTGPSFBTZNBOBHFNFOUBOEEJTDPWFSZ w ίϯςφͷΦʔέετϨʔγϣϯπʔϧ w ུশLT

Slide 7

Slide 7 text

LVCFSOFUFT w 4FSWJDF%JTDPWFSZ w -PBE#BMBODJOH w 3FTJMJFODF w TFMGIFBMJOH w BVUPTDBMJOH w %FQMPZ w SPMMCBDL

Slide 8

Slide 8 text

LVCFSOFUFT w .JDSPTFSWJDFTΛߏ੒͢Δͷʹ࢖ΘΕΔ w 1PE /PEF 4FSWJDF *OHSFTTͳͲͷάϧʔϐϯά w ΞϓϦέʔγϣϯΛಈ͔͢ͷʹඞཁͳίϯς φ܈Λ·ͱΊͯ؅ཧग़དྷΔ w 4FSWJDF%JTDPWFSZͱ͔Λ͏·͘࢖͏ͱ .JDSPTFSWJDFTΛڠௐͤ͞Δ͜ͱ͕ग़དྷΔ

Slide 9

Slide 9 text

טΈࡅ͘ͱ w %PDLFS ίϯςφΛ͍͍ײ͡ʹ؅ཧ͢Δ܅ w 7.ͰΫϥελΛ૊ΜͰɺͦͷ্Ͱ͍͍ײ͡ʹ ෳ਺ͷίϯςφΛڠௐͤ͞Δ w ίϯςφ͕Ϋϥογϡͨ͠Βࣗಈճ෮ w ॲཧ͕௥͍෇͔ͳ͚Ε͹Φʔτεέʔϧ

Slide 10

Slide 10 text

LVCFSOFUFT w ෺ཧαʔόˠ7.ˠίϯςφ w αʔόΛந৅తʹѻ͑͏Α͏ʹͳ͖ͬͯͨ w ଟػೳͳ7.αʔόˠ୯ػೳͳίϯςφ w ࠷ۙͷ.JDSPTFSWJDFTͳྲྀΕ΋͋Δ w ୯ػೳͳίϯςφΛͲ͏૊Έ߹Θͤͯಈ͔͢ ͔ɺεέδϡʔϦϯάͨ͠Γ͢Δͷ͕େม w ͦ͜ͰLVCFSOFUFTͱ͍͏ྲྀΕ w %PDLFS4XBSN͸ૣ͗ͨ͢ʜ

Slide 11

Slide 11 text

ͦͯ͠JNNVUBCMFJOGSBTUSBDUVSF w ઃఆϑΝΠϧ͸શͯZBNM w એݴతͳهड़͕Մೳ w LVCFDUMFEJUͱ໋͍ͬͨྩత ͳίϚϯυ͸ۃྗ࢖Θͣɺ ZBNMΛॻ͍ͯBQQMZ͢ΔͷΛ ৺͕͚Α͏

Slide 12

Slide 12 text

LVCFSOFUFTͷ ֓೦༻ޠ

Slide 13

Slide 13 text

֓೦༻ޠ w 1PE w 3FQMJDB4FU w %FQMPZNFOU w %BFNPO4FU w 4FSWJDF w *OHSFTT w 7PMVNF w $POpH.BQ 4FDSFU w /BNFTQBDF w FUD

Slide 14

Slide 14 text

1PE w ͭҎ্ͷίϯςφͷݻ·Γ w ྫɿ8FCΞϓϦ/HJOYqVFOUE w LVCFSOFUFTͰ؅ཧ͢Δର৅ͷ࠷খ୯Ґ w ஀ੜࢮ๢Λͱ΋ʹ͢Δϓϩηε͕1PE w DQVNFNPSZͳͲͷϦιʔε੍ݶΛ͔͚Δ

Slide 15

Slide 15 text

3FQMJDB4FU w 1PEͷ؅ཧΛ͢Δ w 1PEΛෳ੡ͯ͠Ұఆͷݸ਺Λอͭ w 1PE͕ࢮΜͩΒ৽͘͠1PEΛཱͯΔ w ௚઀࢖͏͜ͱ͸جຊతʹͳ͘ɺ%FQMPZNFOUͷ ࢠཁૉͱͯࣗ͠ಈͰ࡞੒͞ΕΔ w ੲ͸3FQMJDBUJPO$POUSPMMFSͱ͔ݴΘΕ͚ͯͨͲɺ ͍·͸3FQMJDB4FU͕ਖ਼͍͠

Slide 16

Slide 16 text

%FQMPZNFOU w σϓϩΠ͢Δͱ͖͸΄ͱΜͲ͜Ε w 1PEͷ؅ཧΛ͢Δ3FQMJDB4FUͷ؅ཧΛ͢Δ w 3FQMJDB4FUͷػೳΛ࢖ͬͨσϓϩΠ w 1PEͭͣͭೖΕସ͑σϓϩΠ w CMVFHSFFO SFECMBDL σϓϩΠ w ϛεͬͨΒSPMMCBDL

Slide 17

Slide 17 text

%BFNPO4FU w /PEFʹ͚ͭͩσϓϩΠ͍ͨ͠1PEΛ؅ཧ w qVFOUE EBUBEPHΒ΁ΜͰ࢖ΘΕΔ w ಉҰ/PEFʹͨ͘͞Μ͍Βͳ͍΍ͭ w Ͳͷ/PEFʹσϓϩΠ͢Δ͔΋બ୒Ͱ͖Δ w -BCFMͱ͔"OOPUBUJPOΛ࢖͏

Slide 18

Slide 18 text

4FSWJDF w LVCFSOFUFT্Ͱಈ͘ίϯςφ΁ͷΞΫηε w 1PEʹΞΫηε͢ΔͨΊͷ໊લղܾͷ࢓૊Έ w 3FQMJDB4FU΍%FQMPZNFOU಺ͷ1PEʹ΋ಧ͘ w JQUBCMFTͰؤு͍ͬͯΔ ࠷৽൛ͩͱ*174 w $MVTUFS*1 /PEF1PSU -PBE#BMBODFS͕සग़ w $MVTUFS*1LTΫϥελ಺ʹดͨ͡4FSWJDF w /PEF1PSU/PEFͷ͋ΔQPSUΛQSPYZ͢Δ w -PBE#BMBODFS--#

Slide 19

Slide 19 text

*OHSFTT w --# w )551 T -# w 4FSWJDFͷҰछͰ͸ͳͯ͘ผͷίϯϙʔωϯτ w ֤Ϋϥ΢υͱ౷߹͞Ε͍ͯΔ΋ͷΛ࢖͏͜ͱ ͕ଟ͍͔΋ w /HJOYΛ*OHSFTTͱͯ͠࢖ͬͨΓ΋ग़དྷΔ

Slide 20

Slide 20 text

7PMVNF w Ϋϥελ্ͰσʔλΛѻ͏ͨΊͷ΋ͷ w ϑΝΠϧγεςϜ΋΋/'4ͱ͔΋࢖͑Δ w ֤Ϋϥ΢υͷσΟεΫʹରԠ͍ͯ͠Δ w 1FSTJTUFOU7PMVNO$MBJNͱ1FSTJTUFNU7PMVNO౳ Λ૊Έ߹ΘͤͯϘϦϡʔϜΛϚ΢ϯτ͢Δ w ϗετͷσΟϨΫτϦ΍UFNQσΟϨΫτϦΛ 1PEʹϚ΢ϯτ͢Δ͜ͱ΋Մೳ

Slide 21

Slide 21 text

$POpH.BQ4FDSFU w $POpH.BQ؀ڥม਺ͳͲͷઃఆ w 4FDSFUػີ৘ใ w $POpH.BQΑΓݟ͑ͮΒ͍ w ͕ɺผʹTFDVSFͰ΋ͳ͍ CBTFͯ͠Δ͚ͩ

Slide 22

Slide 22 text

$POpH.BQ4FDSFU w 7PMVNFͱͯ͠Ϛ΢ϯτͰ͖Δ w ϛυϧ΢ΣΞͷDPOG͸$POpH.BQͰ؅ཧՄೳ $POpH.BQ %FQMPZNFOU

Slide 23

Slide 23 text

/BNFTQBDF w ͦͷ໊ͷ௨Γ໊લۭؒ w LTΫϥελΛԾ૝తʹ෼཭͢Δ w /BNFTQBDFΛ௒͑ͨ௨৴͕ग़དྷͳ͍ w LVCFTZTUFN LVCFQVCMJD EFGBVMU͕جຊ w QSPEVDUJPO TUBHJOH w BQJ CBUDI w ͳͲ੾Γޱ͸ࣗ༝

Slide 24

Slide 24 text

LVCFSOFUFTͷΞʔΩςΫνϟ

Slide 25

Slide 25 text

LTͷΞʔΩςΫνϟ w NBTUFS DPOUSPMQMBOF ͱXPSLFSϊʔυ w Ϋϥ΢υͷϑϧϚωʔδυLTαʔϏε͸ NBTUFSϊʔυΛ؅ཧͯ͘͠Ε͍ͯΔ w NBTUFSͷ৑௕ߏ੒΍όʔδϣϯΞοϓ౳ w جຊతʹ͸XPSLFSϊʔυ͚ͩߟ͑Ε͹0,

Slide 26

Slide 26 text

IUUQTFOXJLJQFEJBPSHXJLJ,VCFSOFUFT

Slide 27

Slide 27 text

IUUQTLVCFSOFUFTJPEPDTDPODFQUTBSDIJUFDUVSFDMPVEDPOUSPMMFS

Slide 28

Slide 28 text

w LVCFBQJTFSWFS w LTͷ"1*Ͱɺ΄΅શͯͷίϯϙʔωϯτ͕BQJTFSWFSΛܦ༝͢Δ w LVCFDUMͷड͚ޱʹ΋ͳ͍ͬͯΔ w LVCFEOT $PSF%/4 w LTΫϥελ಺Ͱͷ໊લղܾ΍αʔϏεσΟεΧόϦʹ࢖༻͞ΕΔ%/4 w LVCFDPOUSPMMFSNBOBHFS w EFQMPZNFOUDPOUSPMMFSͳͲΛ࣮ߦ؂ࢹΛߦ͏ w LVCFMFU w ֤/PEFʹσϓϩΠ͞Εɺ%PDLFSͱ࿈ܞͯ͠ίϯςφͷ؅ཧΛߦ͏ w LVCFQSPYZ w ֤/PEFʹσϓϩΠ͞ΕɺτϥϑΟοΫΛసૹͯ͠4FSWJDFΛػೳͤ͞Δ w LVCFTDIFEVMFS w 1PEͷεέδϡʔϦϯά w FUDE w ෼ࢄ,74ͰɺLTΫϥελ಺ͷ৘ใ͕શͯอଘ͞ΕΔ

Slide 29

Slide 29 text

LVCFSOFUFTͷجຊૢ࡞

Slide 30

Slide 30 text

LVCFSOFUFTͷجຊૢ࡞ w LVCFDUM w ͖ΎʔͿ͜ΜͱΖʔΔ w DSFEFOUJBM w Ϋϥ΢υϓϩόΠμ͔Βೝূ৘ใΛऔಘ w DPOUFYU w ͲͷLTΫϥελʹΞΫηε͢Δ͔ $ kubectl config get-contexts

Slide 31

Slide 31 text

LVCFSOFUFTͷجຊૢ࡞ $ alias kubectl=ku # お好みで $ ku get (e.g. pod, deployment, ns) $ ku describe /(e.g. deploy/my-api) $ ku logs $ ku logs --tail 1000 -f # 最新1000行 + 垂れ流し $ ku apply -f # createではなくこちら $ ku config get-contexts $ ku config use-context $ ku config set-context —namespace=

Slide 32

Slide 32 text

LVCFSOFUFTͷσόοά $ ku describe / # まず見るべき情報 $ ku get -v=6 pod # 詳細なログを表示できる $ ku exec -it /bin/bash # docker execと同じ $ ku port-forward : $ ku run -it # docker runと同じ $ ku proxy # dashboardを見る $ ku cp pod: # scpと同じ

Slide 33

Slide 33 text

LVCFSOFUFTΛӡ༻͢ΔͨΊʹ

Slide 34

Slide 34 text

LTΛӡ༻͢ΔͨΊʹ w ஌͓͖͍ͬͯͨ͜ͱ w 1PEΛͲ͏࡞Δ͔ w ઃఆͰ͖Δ͜ͱ ZBNMͰԿΛॻ͔͘ w ϞχλϦϯά w σόοά w πʔϧ

Slide 35

Slide 35 text

1PEΛͲ͏࡞Δ͔

Slide 36

Slide 36 text

1PEΛͲ͏࡞Δ͔ w GBDUPSBQQ IUUQTGBDUPSOFUKB

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

1PEΛͲ͏࡞Δ͔ w 1PEͷݪଇ w ੜ͖ࢮʹΛͱ΋ʹ͢Δີ݁߹ͳϓϩηε܈ w ίϯςφࣗମ͸جຊతʹϓϩηεͷΈ w 8FC"QQ/HJOYqVFOUEͳΒίϯςφ w ࠶ར༻Մೳͳίϯςφ͸੾Γग़͢ w 4JEF$BSύλʔϯͱ͔ݺ͹ΕΔ w 8FC"QQ/HJOY Ͱίϯςφʹ͠ͳ͍

Slide 39

Slide 39 text

1PEΛͲ͏࡞Δ͔ w ઃఆϑΝΠϧ͸֎͔Βࠩ͠ࠐΊΔΑ͏ʹ͢Δ w $POpH.BQͰϑΝΠϧΛ؅ཧͯ͠Ϛ΢ϯτ w OHJOYDPOGͱ͔BQQMJDBUJPODPOGͱ͔ w Πϝʔδ࠶࡞੒Ͱ͸ͳͯ͘$POpHॻ͖׵͑

Slide 40

Slide 40 text

ઃఆͰ͖Δ͜ͱ

Slide 41

Slide 41 text

ઃఆͰ͖Δ͜ͱ w ZBNMͰઃఆͰ͖Δͷ͸ެࣜEPDTΛ·ͣಡΉ w ஌͓͍ͬͯͨํ͕͍͍΍ͭ w JNBHF1VMM1PMJDZ JNBHF1VMM4FDSFU w WPMVNFͷϚ΢ϯτͷ࢓ํ w ϔϧενΣοΫ MJWFOFTTSFBEJOFTTQSPCF w NFNPSZDQVͷSFRVFTUMJNJU

Slide 42

Slide 42 text

MJWFOFTTSFBEJOFTTQSPCF w LTಛ༗ͳࢮ׆؂ࢹ w ίϚϯυ࣮ߦɺIUUQϦΫΤετͳͲͰνΣοΫ͢Δ w MJWFOFTT w ੜ͖ͯΔ͔Ͳ͏͔νΣοΫ w ͩΊͩͬͨΒ1PE࠶ىಈ w SFBEJOFTT w αʔϏεՔಇͰ͖Δ͔νΣοΫ w 1PE࠶ىಈ͸͞Εͳ͍͕τϥϑΟοΫ΋ఀࢭ

Slide 43

Slide 43 text

MJWFOFTTSFBEJOFTTQSPCF w LTಛ༗ͳࢮ׆؂ࢹ w ίϚϯυ࣮ߦɺIUUQϦΫΤετͳͲͰνΣοΫ͢Δ w MJWFOFTT w ੜ͖ͯΔ͔Ͳ͏͔νΣοΫ w ͩΊͩͬͨΒ1PE࠶ىಈ w SFBEJOFTT w αʔϏεՔಇͰ͖Δ͔νΣοΫ w 1PE࠶ىಈ͸͞Εͳ͍͕τϥϑΟοΫ΋ఀࢭ

Slide 44

Slide 44 text

SFRVFTUTMJNJUT w Ϧιʔεͷཁٻͱ੍ݶ w ࣮ࡍʹSFRVFTUͨ͠෼Λ͖ͬͪΓ࢖͏Θ͚Ͱ͸ͳ͘ɺ σϓϩΠͷ࣌ʹνΣοΫ͞ΕΔ w $16ͷMJNJU௒ա͸஗͘ͳΔ w NFNPSZͷMJNJU௒ա͸00.ͰLJMM͞ΕΔ w 1PEͷઃఆʹΑͬͯ͸ࣗಈͰ࠶ىಈ͞ΕΔ w 2P4΋͋Θͤͯ஌͓ͬͯ͘ͱྑ͍ w #FTU&GGPSU#VSTUBCMF(VBSBOUFFE https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/

Slide 45

Slide 45 text

SFRVFTUTMJNJUT w $16 w ίΞ਺ϛϦίΞඵΛࢦఆ͢Δ w ίΞN w NFNPSZ w ϝϏόΠτͰࢦఆ͠Α͏ w .J#,# https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/

Slide 46

Slide 46 text

ϞχλϦϯά

Slide 47

Slide 47 text

ϞχλϦϯά w LVCFDUMUPQ w %BUBEPHΛ%BFNPO4FUͰ͍Εͯ؂ࢹ w LVCFTUBUFNFUSJDTܦ༝Ͱৄࡉ৘ใʹΞΫηε

Slide 48

Slide 48 text

ϞχλϦϯά w ϊʔυ )PTU w ྫ -"ͱ͔σΟεΫ༰ྔͱ͔ w ίϯςφ w ྫ 1PE಺ͷ%PDLFSίϯςφͷ$16 w LVCFSOFUFT w ྫ %FQMPZNFOU഑ԼͰSFBEZͳ1PE਺

Slide 49

Slide 49 text

πʔϧ

Slide 50

Slide 50 text

πʔϧ w LVCFDUM w લड़ͷLVCFSOFUFTͷඪ४$-*πʔϧ w LVTUPNJ[F w σϓϩΠ͢Δ؀ڥ͝ͱʹZBNMΛੜ੒ w TUFSO w ϩάΛ͍͍ײ͡ʹΈΔ w LVCFDUYLVCFOT w DPOUFYUOBNFTQBDFΛ੾Γସ͑ w NJOJLVCFEPDLFSGPSNBD w ϩʔΧϧʹLVCFSOFUFTΫϥελߏங

Slide 51

Slide 51 text

LVTUPNJ[F w LVCFSOFUFTTJHTLVTUPNJ[F w ؀ڥ͝ͱʹมߋ͍ͨ͠ઃఆ஋Λ؅ཧ w ؀ڥ͝ͱʹ༻ҙ͞ΕͨઃఆϑΝΠϧΛϚʔδ ͯ͠ڊେͳZBNMΛੜ੒͢Δ

Slide 52

Slide 52 text

$ # yamlを生成(標準出力) $ kustomize build overlays/development/ $ # yaml生成 + kubectl apply $ kustomize build overlays/production/ \ | kubectl apply -f -

Slide 53

Slide 53 text

TUFSO w XFSDLFSTUFSO w LVCFDUMMPHTͱҧͬͯෳ਺1PEͷϩάΛ·ͱΊ ͯྲྀ͢͜ͱ͕ग़དྷΔ $ stern $ stern --tail 1000 my-api

Slide 54

Slide 54 text

͍͞͝ʹ

Slide 55

Slide 55 text

͍͞͝ʹ ৮ͬͯΈͳ͍ͱΘ͔Βͳ͍ͷͰɺ৮ͬͯΈͯ͘ ͍ͩ͞ MPDBMʹNJOJLVCFEPDLFSGPSNBD(,&ͰLTΫ ϥελΛ্ཱͪ͛ͯ%FQMPZNFOU΍4FSWJDFΛಈ ͔ͨ͠ΓEBTICPBSEΛݟͨΓ͢Δͷ͕ྑ͍Ͱ͢

Slide 56

Slide 56 text

5IBOLZPV