Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DockerとKubernetesでアプリケーション開発にコンテナをフル活用!
Search
stormcat24
November 08, 2018
Programming
0
290
DockerとKubernetesでアプリケーション開発にコンテナをフル活用!
11/7開催:DockerとKubernetesでアプリケーション開発にコンテナをフル活用!
http://www.itstaffing.jp/engineer/entry/20181022_2_1
stormcat24
November 08, 2018
Tweet
Share
More Decks by stormcat24
See All by stormcat24
素早く賢く失敗するDeveloper Productivityの実現を目指して
stormcat24
4
4.6k
KubernetesのマニフェストをそれなりにCIしたい
stormcat24
4
1.3k
令和時代のSaaS開発
stormcat24
1
250
History in 5 years of CircleCI and CyberAgent
stormcat24
3
810
Kubernetes Handson Osaka
stormcat24
5
550
Kubernetes Handson
stormcat24
5
4.2k
Base Image Journey 2018
stormcat24
29
130k
kotlin-fest
stormcat24
13
17k
Kotlin/Native
stormcat24
0
970
Other Decks in Programming
See All in Programming
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
useSyncExternalStoreを使いまくる
ssssota
6
1k
Symfony Mapper Component
soyuka
2
730
ドメインイベント増えすぎ問題
h0r15h0
1
130
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
360
.NET 9アプリをCGIとして レンタルサーバーで動かす
mayuki
1
770
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
660
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
nekko cloudにおけるProxmox VE利用事例
irumaru
3
420
103 Early Hints
sugi_0000
1
220
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Why Our Code Smells
bkeepers
PRO
335
57k
A Tale of Four Properties
chriscoyier
157
23k
Become a Pro
speakerdeck
PRO
26
5k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Site-Speed That Sticks
csswizardry
2
190
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Transcript
%PDLFSͱ,VCFSOFUFTͰ ΞϓϦέʔγϣϯ։ൃʹ ίϯςφΛϑϧ׆༻ʂɹ "LJOPSJ:BNBEB!TUPSNDBU
1SPGJMF ‣ "LJOPSJ:BNBEB ‣ $ZCFS"HFOU *OD ‣ '3&4)-*7&UFDIMFBE ‣ IUUQTCMPHTUPSNDBUJP
stormcat24
%PDLFS,VCFSOFUFT ࣮ફίϯςφ։ൃೖ ʢٕज़ධࣾʣ
ίϯςφࣝθϩ͔ΒͰɺ ຊ൪ڥͰίϯςφΛ͑Δ·Ͱʹ ҰؾʹεΩϧҾ্͖͛ΔຊͰ͢
)FBEMJOF ‣ %PDLFSͱʁίϯςφͱʁ ‣ %PDLFSΛମݧ͢Δ ‣ %PDLFSϑϨϯυϦͳΠϝʔδΛͭ͘Δ ‣ ίϯςφΦʔέετϨʔγϣϯͱʁ ‣
,VCFSOFUFTͰͷ࣮ફతͳΞϓϦέʔγϣϯ։ൃ ‣ ύϒϦοΫΫϥυͰͷίϯςφӡ༻ ‣ ίϯςφͷӡ༻Λࢧ͑Δπʔϧ
%PDLFSͱʁ ίϯςφͱʁ
%PDLFSίϯςφʹͲͷΑ͏ͳ ҹΛ͍࣋ͬͯ·͔͢ʁ
%PDLFSʁίϯςφʁ Ծڥʁ Πϯϑϥ ٕज़ʁ ܰྔʁ ͍ॴʁ ։ൃڥ ͚ʁ
%PDLFSͱ ‣ ίϯςφܕԾٕज़Λ࣮ݱ͢ΔͨΊͷৗறΞϓϦέʔγϣϯͱ ίϚϯυϥΠϯπʔϧ͔ΒΔϓϩμΫτ ‣ Πϯϑϥٕज़ͱ͍͏ΑΓɺΞϓϦέʔγϣϯͷσϓϩΠʹಛ Խٕͨ͠ज़ ‣ ɺ4PMPNPO)ZLFT͕044ͱͯ͠ެ։ ‣
Ҏޙɺ%PDLFSࣾίϛϡχςΟΛத৺ʹ༷ʑͳπʔϧΤίγ εςϜ͕։ൃɺίϯςφٕज़ͷΦʔϓϯԽ͕ਐΊΒΕ͍ͯΔ
දతͳԾԽٕज़ ϗετ04ܕ ԾԽٕज़ ίϯςφܕ ԾԽٕज़
ԾԽٕज़ͷҧ͍
ϗετܕԾԽٕज़ͷಛ ‣ ϗετܕԾԽͰɺԾԽιϑτΣΞΛར༻͠ɺϋʔυΣ ΞΛ$16ԋࢉʹΑͬͯ࠶ݱ͠ɺήετ04Λ࡞Γग़͢ ‣ Ծ04ͷ࠶ݱ͕ߴ͍ɺىಈॲཧͷΦʔόʔϔου͕େ͖ ͘ͳΔ ‣ 7.XBSF1MBZFS 0SBDMF7JSUVBM#PY
ίϯςφܕԾԽٕज़ͷಛ ‣ ϗετܕͱҧ͍ɺίϯςφϗετ04ͷΧʔωϧϦιʔεΛ ڞ༗ͯ͠ར༻ ‣ ιϑτΣΞແ͠Ͱɺ04ͷϦιʔεΛཧతʹԾ04ʢίϯς φʣͱִͯ͢͠Δ ‣ ίϯςφܕͰɺԾ0404ͷશͯͷػೳΛ࠶ݱ͢ΔΘ͚Ͱ ͳ͍ͨΊɺͦͷϗετܕΑΓΦʔόʔϔου͕খ͍͞
‣ %PDLFSҎલ-9$ -JOVY$POUBJOFST ͕༗໊
%PDLFSͷԾԽΞʔΩςΫνϟͷมભ
%PDLFSΛԿʹ͏ʁ
%PDLFSΞϓϦέʔγϣϯͷ σϓϩΠʹಛԽٕͨ͠ज़
ΞϓϦέʔγϣϯͷσϓϩΠʹಛԽͨ͠ಛ ‣ ϗετʹࠨӈ͞Εͳ͍࣮ߦڥɺڥࠩҟ͔Βͷ٫ ‣ %PDLFSGJMFͰͷίϯςφߏɾΞϓϦέʔγϣϯஔఆٛ ‣ Πϝʔδͷόʔδϣϯཧ ‣ ࠩϏϧυ͕ՄೳͳϨΠϠʔߏΛ࣋ͭΠϝʔδϑΥʔϚοτ ‣
%PDLFSϨδετϦʢΠϝʔδͷอαʔόʣ ‣ ϓϩάϥϚϒϧͳ֤छ"1* ˞-9$ܰྔ͕ͩɺ͜ͷ؍͕͚͍ܽͯΔ
༏ΕͨϙʔλϏϦςΟ MPDBM EFWFMPQNFOU TUBHJOH QSPEVDUJPO %PDLFS͕Πϯετʔϧ͞Ε͍ͯΕɺ ಉ͡Πϝʔδ͔Β࡞ΒΕΔίϯςφΛଞͷϗετͰ༰қʹ࣮ߦͰ͖Δ
ϙʔλϏϦςΟ͕ͨΒͨ͠ͷ ‣ ίϯςφʹΑͬͯɺήετ04ͱΞϓϦέʔγϣϯΛηοτͰΠ ϝʔδͱͯ͠ύοέʔδϯάͰ͖Δ ‣ %PDLFSίϯςφʹΑΔڥͷ࠶ݱੑ ‣ ΠϯϑϥͷଘࡏΛʢ͋·ΓʣؾʹͤͣʹσϓϩΠͰ͖Δ %PDLFSΛϑϧ׆༻ͨ͠։ൃͷྲྀߦ
%PDLFSΛମݧ͢Δ
ڥߏங
ϩʔΧϧͰͷ%PDLFSڥߏங ‣ %PDLFS%FTLUPQ ‣ IUUQTXXXEPDLFSDPNQSPEVDUTEPDLFSEFTLUPQ
ϩʔΧϧͰͷ%PDLFSڥߏங
ϩʔΧϧͰͷ%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
%PDLFSΠϝʔδΛऔಘ͠ɺ %PDLFSίϯςφΛ࣮ߦ͢Δ
Πϝʔδͱίϯςφͷҧ͍ ‣ %PDLFSΠϝʔδ ‣ %PDLFSίϯςφΛߏ͢ΔϑΝΠϧγεςϜɺ࣮ߦ͢ΔΞ ϓϦέʔγϣϯઃఆΛ·ͱΊͨͷ ‣ ίϯςφΛ࡞͢ΔͨΊʹར༻͞ΕΔςϯϓϨʔτͱͳΔ ‣ %PDLFSίϯςφ
‣ %PDLFSΠϝʔδΛجʹ࡞͞Εɺ۩ݱԽ͞ΕͨϑΝΠϧγε ςϜͱΞϓϦέʔγϣϯ͕࣮ߦ͞Ε͍ͯΔঢ়ଶ
Πϝʔδͱίϯςφͷҧ͍
FDIPίϯςφΛ࣮ߦ͢Δ ‣ HJIZPEPDLFSFDIPMBUFTUͱ͍͏Πϝʔδ͔ΒίϯςφΛ࣮ߦ ‣ ͜ͷΠϝʔδ%PDLFS)VCʹอ࣋͞Ε͍ͯΔ ‣ (&5ϦΫΤετΛ͛Δͱʮ)FMMP%PDLFSʯΛฦ͢ Demo-1
FDIPίϯςφΛ࣮ߦ͢Δ Demo-1 %PDLFSΠϝʔδͷμϯϩʔυ EPDLFSJNBHFQVMMHJIZPEPDLFSFDIPMBUFTU %PDLFSίϯςφͷ࣮ߦ EPDLFSDPOUBJOFSSVOJUQHJIZPEPDLFSFDIPMBUFTU ϗετOS echoίϯςφ Port 8080
Port 9000 ϙʔτϑΥϫʔυ HTTP GET
FDIPίϯςφΛ࣮ߦ͢Δ Demo-1 ϑΥΞάϥϯυͰͷ࣮ߦ EPDLFSDPOUBJOFSSVOJUQHJIZPEPDLFSFDIPMBUFTU TUBSUTFSWFS SFDFJWFESFRVFTU όοΫάϥϯυͰͷ࣮ߦ EPDLFSDPOUBJOFSSVOEQHJIZPEPDLFSFDIPMBUFTU GEGGBBFCEʜ "1*8FCΞϓϦέʔγϣϯͰɺόοΫάϥϯυͰ࣮ߦ͢Δ
%PDLFSΠϝʔδΛϏϧυ͢Δ
%PDLFSGJMF ‣ '30.ϕʔεͱ͢ΔΠϝʔδΛܾఆ͢Δ ‣ $01:ϗετ͔ΒίϯςφʹϑΝΠϧΛίϐʔ͢Δ ‣ 36/ίϯςφͰҙͷॲཧΛ࣮ߦ͢Δ ‣ $.%Πϝʔδ͔ΒίϯςφΛ࡞͢ΔࡍʹɺίϯςφͰ࣮ߦ ͢ΔϝΠϯϓϩηεΛઃఆ͢Δ
%PDLFSΠϝʔδΛϏϧυ͢Δ Demo-2 USFF ᵓᴷᴷ%PDLFSpMF ᵋᴷᴷIFMMPXPSME EJSFDUPSJFT pMFT IFMMPXPSMEεΫϦϓτΛίϯςφͰ࣮ߦ͢ΔͨΊͷΠϝʔδΛͭ͘Δ
%PDLFSΠϝʔδΛϏϧυ͢Δ Demo-2 '30.VCVOUV $01:IFMMPXPSMEVTSMPDBMCJO 36/DINPE YVTSMPDBMCJOIFMMPXPSME $.%<IFMMPXPSME>
%PDLFSΠϝʔδΛϏϧυ͢Δ Demo-2 IFMMPXPSMEMBUFTUͱ͍͏໊લͰΠϝʔδΛϏϧυ EPDLFSJNBHFCVJMEUIFMMPXPSMEMBUFTU 3FNPWJOHJOUFSNFEJBUFDPOUBJOFSDEBB DGBF 4VDDFTTGVMMZCVJMUDGBF 4VDDFTTGVMMZUBHHFEIFMMPXPSMEMBUFTU ࡞ͨ͠ΠϝʔδΛ֬ೝ
EPDLFSJNBHFMTcHSFQIFMMPXPSME IFMMPXPSMEMBUFTUDGBFNJOVUFTBHP.#
Πϝʔδ͔ΒίϯςφΛ࣮ߦ Demo-2 ࡞ͨ͠Πϝʔδ͔ΒίϯςφΛ࣮ߦ EPDLFSDPOUBJOFSSVOIFMMPXPSMEMBUFTU )FMMP 8PSME IFMMPXPSMEεΫϦϓτ͕ίϯςφͰ࣮ߦ εΫϦϓτ͕ऴྃ͢Δͱίϯςφऴྃ͢Δ
%PDLFSϑϨϯυϦͳ ΠϝʔδΛͭ͘Δ
˞͓͞Β͍ %PDLFS༏ΕͨϙʔλϏϦςΟΛ࣋ͭ
ίϯςφෳ͍͕͢͠ɾɾɾ EFWFMPQNFOU TUBHJOH QSPEVDUJPO ࣮ࡍʹΞϓϦέʔγϣϯͷڍಈ σϓϩΠ͢ΔڥʹΑ੍ͬͯޚ͢Δඞཁ͕͋Δ FHσʔλϕʔεͷଓઌ FHΞϓϦέʔγϣϯ͕ར༻͢Δ"1*ͷϗετ
ίϯςφͷڍಈΛઃఆͰ੍ޚ͢Δ
ઃఆΛίϯςφʹ͢ํ๏ ‣ ࣮ߦ࣌ͷҾ ‣ ઃఆ͕ଟ͍߹ɺऔΓճ͠ʹ͍͘ ‣ ΞϓϦέʔγϣϯͷڥผઃఆϑΝΠϧ ‣ EFWFMPQ TUBHJOH
QSPEVDUJPOผͷઃఆϑΝΠϧΛؚΊΔ ‣ ڥ͕૿͑Δ߹ɺΞϓϦέʔγϣϯʴΠϝʔδͷϏϧυ͕ඞཁ ‣ ڥม ‣ ࠷Ԧಓͷख๏
ڥม੍ޚͷྑ͞ ‣ ڥผઃఆϑΝΠϧͱҧ͍ɺڥՃͷ߹ʹઃఆϑΝΠϧΛ Ճͯ͠Ϗϧυ͢Δඞཁ͕ແ͍ ‣ ڥม୯ҐͰ੍ޚͰ͖ΔͷͰখճΓ͕ޮ͘ ‣ FH%#ͷίωΫγϣϯϓʔϧαΠζ͚ͩΛมߋ͢Δ ‣ τϥΠΞϯυΤϥʔͷ͢͠͞
ڥมΛ׆༻͢Δ %PDLFSϑϨϯυϦͳ Πϝʔδ࡞ʹܨ͕Δ
FH4QSJOHͷQSPQFSUJFTϑΝΠϧ ECESJWFS$MBTT\%#@%3*7&3@$-"44DPNNZTRMKECD%SJWFS^ ECKECD6SM\%#@+%#$@63-^ ECVTFS\%#@64&3^ ECQBTTXPSE\%#@1"44803%^ ECJOJUJBM4J[F\%#@*/*5*"-@4*;&^ ECNBY"DUJWF\%#@."9@"$5*7&^ ECNBY*EMF\%#@."9@*%-&^ ECNJO*EMF\%#@.*/@*%-&^ ΞϓϦέʔγϣϯڥมΛऔΕΔ࡞Γʹ͢Δ͜ͱ͕ॏཁʂ
ίϯςφΦʔέετϨʔγϣϯ ͱʁ
ίϯςφͰγεςϜΛߏங͢Δ ଟ͘ͷίϯςφΛσϓϩΠͰ͖Δ ଟ͘ͷ%PDLFSϗετ͕ඞཁ
ίϯςφͷஔ͍͠ ‣ ͲͷछྨͷίϯςφΛͲͷΑ͏ʹஔ͢Δ͔ʁ ‣ ϗετͷϚγϯϦιʔεΛޮతʹ͏ஔͲ͏ͳΔ͔ʁ ‣ ίϯςφͷΞΫηεܦ࿏ΛͲ͏ܾΊΔ͔ʁ ‣ εέʔϧΞτΠϯΛͲͷΑ͏ʹߦ͏͔ʁ %PDLFS)PTU
%PDLFS)PTU %PDLFS)PTU %PDLFS)PTU # & " % # & $ % & " $ %
ਓ͕ؒߟ͑Δ͜ͱ͡Όͳ͍
ෳͷϗετΛލ͗ ෳछͷίϯςφΛໃ६ͷແ͍ܗͰ αʔόϦιʔεΛߟྀ͠ޮతʹஔ͢Δ ίϯςφΦʔέετϨʔγϣϯٕज़
දతͳίϯςφΦʔέετϨʔγϣϯٕज़ ‣ %PDLFS$PNQPTF ‣ %PDLFS4XBSN4UBDL ‣ ,VCFSOFUFT ‣ "QBDIF.FTPT ‣
"NB[PO&$$POUBJOFS4FSWJDFT &$4
σϑΝΫτελϯμʔυ ,VCFSOFUFT
,VCFSOFUFTͰͷ ࣮ફతͳΞϓϦέʔγϣϯ։ൃ
,VCFSOFUFTͱʁ ‣ ΫόωςΟεɺΫʔϕϧωΟςΟεͱಡΉ ‣ ུশLVCFLT ‣ (PPHMFࣾͷίϯςφج൫͔Βੜ ‣ 044ͷίϯςφΦʔέετϨʔγϣϯγεςϜ ‣
༷ʑͳϓϥοτϑΥʔϜʹରԠͰߴػೳ ‣ ίϯςφͷஔɺϧʔςΟϯάͷܾఆΛ͍͍ײ͡ʹͬͯ ͘ΕΔ
ϩʔΧϧڥߏங %PDLFS%FTLUPQͷ,VCFSOFUFT౷߹Λ༗ޮʹ͢Δ
LVCFDUM ‣ ,VCFSOFUFTΫϥελͷϦιʔεΛૢ࡞ɾӾཡ͢ΔͨΊͷίϚϯ υϥΠϯπʔϧ ‣ %PDLFS%FTLUPQͷ,VCFSOFUFT౷߹Λ༗ޮʹ͢ΔͱɺࣗಈͰΠ ϯετʔϧ͞ΕΔ
,VCFSOFUFTͷϦιʔε
Ϧιʔεͱʁ ‣ ,VCFSOFUFTʹ͓͍ͯɺΞϓϦέʔγϣϯͷσϓϩΠΛ࣮ݱ͢Δ ͨΊʹඞཁͳ෦ͷΑ͏ͳͷ ‣ ࣮ߦ͞ΕΔΞϓϦέʔγϣϯ༷ʑͳϦιʔεͱڠௐ͢Δ͜ͱ ͰɺγεςϜͱͯ͠ಈ࡞͢Δ
%FQMPZNFOU /BNFTQBDF 4FSWJDF *OHSFTT $POGJH.BQ %BFNPO4FU 4UBUFGVM4FU +PC 1PE 3FQMJDB4FU
+PC $SPO+PC ,VCFSOFUFTͷϦιʔεͨͪ
%FQMPZNFOU /BNFTQBDF 4FSWJDF *OHSFTT $POGJH.BQ %BFNPO4FU 4UBUFGVM4FU +PC 1PE 3FQMJDB4FU
+PC $SPO+PC ,VCFSOFUFTͷϦιʔεͨͪ ࠓ͜ͷͭΛհ͠·͢
1PE
1PE ‣ ίϯςφͷू߹ମͷ୯ҐͰɺগͳ͘ͱͭͷίϯςφΛ࣋ͭ ‣ ίϯςφಉ͕࢜ີ݁߹Ͱ͋Δํ͕߹͕ྑ͍߹ɺ1PEͱͯ͠ ෳछίϯςφΛ·ͱΊͯσϓϩΠ͢Δ ‣ ,VCFSOFUFTͰίϯςφ୯ҐͰͳ͘ɺ1PE୯ҐͰσϓϩΠ͞ ΕΔ
1PE
1PEͷஔΠϝʔδ
/PEFލ͗/( 1PEͰάϧʔϐϯά͞Εͨίϯςφ ಉ͡/PEFʹஔ͞ΕΔ
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ΛσϓϩΠ͢Δ
ଞͷίϯςφͲ͏ࢀর͢Δ͔ʁ Demo-3 1PE͕ࣗͭͷԾϚγϯͷΑ͏ͳͷ FDIPίϯςφͷϙʔτɺ OHJOY͔ΒMPDBMIPTUͱݟ͑Δ
1PEΛσϓϩΠ͢Δ Demo-3 ϚχϑΣετϑΝΠϧΛɺ,VCFSOFUFTΫϥελʹద༻͢Δ LVCFDUMBQQMZGTJNQMFQPEZBNM ࡞ͨ͠1PEΛ֬ೝ͢Δ LVCFDUMHFUQPE ࡞ͨ͠1PEͷϩάΛ֬ೝ͢Δ LVCFDUMMPHTGTJNQMFFDIPDFDIP ࡞ͨ͠1PEͷίϯςφͷதʹೖΔɹ LVCFDUMFYFDJUTJNQMFFDIPTIDOHJOY
%FQMPZNFOU
%FQMPZNFOU ‣ 1PEͭͷϚχϑΣετϑΝΠϧʹ͖͔ͭͭ͠࡞Ͱ͖ͳ͍ ‣ ࣮ӡ༻Ͱɺಉ͡1PEΛେྔʹෳ͢Δ͜ͱͰՄ༻ੑΛߴΊΔ ‣ 3FQMJDB4FUͰ1PEͷෳ͕Ͱ͖Δ͕ɺ%FQMPZNFOU3FQMJDB4FU ΛੈཧͰ͖ΔͨΊɺϩʔϧόοΫՄೳ ‣ جຊతʹɺ1PE3FQMJDB4FUͷϚχϑΣετͰͳ͘
%FQMPZNFOUͷϚχϑΣετϑΝΠϧΛ࡞͢Δͱߟ͑ͯ0,
%FQMPZNFOUͱͷؔ࿈
%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ఆٛͱಉ͡
%FQMPZNFOUΛ࡞͢Δ Demo-4 ϚχϑΣετϑΝΠϧΛɺ,VCFSOFUFTΫϥελʹద༻͢Δ LVCFDUMBQQMZGTJNQMFEFQMPZNFOUZBNM ࡞ͨ͠%FQMPZNFOUΛ֬ೝ͢Δ LVCFDUMHFUEFQMPZNFOUTFMFDUPSBQQFDIP 1PE͕ෳੜ͞Ε͍ͯΔ͔Λ֬ೝ͢Δ LVCFDUMHFUQPETFMFDUPSBQQFDIP
4FSWJDF
4FSWJDF ‣ 1PEͷू߹ʹର͢ΔϧʔςΟϯάαʔϏεσΟεΧόϦػೳ Λఏڙ͢ΔϦιʔε ‣ ಉ͡छྨͷෳ1PEʹର͠ɺτϥϑΟοΫΛྲྀͨ͢Ίͷϩʔυ όϥϯαʔͱͯ͠ͷػೳ࣋ͭ ‣ 4FSWJDF͔ΒͷτϥϑΟοΫͷసૹɺઃఆ͞ΕͨTFMFDUPSTͷ ϥϕϧͷʹΑܾͬͯఆ͞ΕΔ
‣ ,VCFSOFUFTΫϥελ෦Ͱɺ4FSWJDFͷ໊લͰ4FSWJDFʹ໊લ ղܾͰ͖Δ
4FSWJDFʹΑΔ1PEͷݟ͚ͭํ
4FSWJDFͷϚχϑΣετ Demo-5 apiVersion: v1 kind: Service metadata: name: echo spec:
selector: app: echo release: summer ports: - name: http port: 80 ˡTFMFDUPSͰఆٛͨ͠ϥϕϧʹ Ϛον͢Δ1PEʹτϥϑΟοΫΛྲྀ͢
4FSWJDFΛ࡞͢Δ Demo-5 ϚχϑΣετϑΝΠϧΛɺ,VCFSOFUFTΫϥελʹద༻͢Δ LVCFDUMBQQMZGTJNQMFTFSWJDFZBNM ࡞ͨ͠4FSWJDFΛ֬ೝ͢Δ LVCFDUMHFUTWDFDIP σόοά༻ͷ1PEΛ࡞Γɺ͔ͦ͜Β࡞ͨ͠4FSWJDFʹରͯ͠)551ϦΫΤετ LVCFDUMSVOJSNUUZEFCVHJNBHFHJIZPEPDLFSGVOEBNFOUBM SFTUBSU/FWFSCBTIJM
*OHSFTT
*OHSFTT ‣ 4FSWJDFΫϥελ෦͔Β͔͠ΞΫηεͰ͖ͳ͍ ‣ 4FSWJDFΫϥελ֎෦ެ։͢ΔͨΊͷϦιʔε͕*OHSFTT ‣ 8FCΞϓϦέʔγϣϯ"1*ΞϓϦέʔγϣϯΛΠϯλʔωο τʹެ։͢Δ߹ඞཁ
*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ʣ
*OHSFTTΛ࡞͢Δ Demo-6 ϚχϑΣετϑΝΠϧΛɺ,VCFSOFUFTΫϥελʹద༻͢Δ LVCFDUMBQQMZGTJNQMFJOHSFTTZBNM ࡞ͨ͠*OHSFTTΛ֬ೝ͢Δ LVCFDUMHFUJOHSFTT Ϋϥελ֎ʢϩʔΧϧʣ͔Βɺެ։͍ͯ͠Δ*OHSFTTʹରͯ͠ϦΫΤετΛૹΔɹ DVSMIUUQMPDBMIPTU))PTUFDIPHJIZPMPDBM`
͜͜·Ͱ͕Ұ௨ΓͷྲྀΕ ‣ 4FSWJDF*OHSFTTҰ࡞ͬͯ͠·͑ɺมߋ͕ͳ͍ݶΓͦͷ ·· ‣ ܁Γฦ͠σϓϩΠ͢Δ߹ɺ%FQMPZNFOUʹߋ৽Λ͔͚ɺ৽͠ ͍ੈͷ3FQMJDB4FUͱ1PE͕࡞ΒΕΔ ‣ *OHSFTT4FSWJDF%FQMPZNFOUͷϚχϑΣετΛύοέʔδϯ ά͠ɺҰׅͰσϓϩΠ͢Δ)FMNͱ͍͏πʔϧ͋Δ
ࢀߟɿΑΓ࣮ફతͳߏ
ύϒϦοΫΫϥυͰͷ ίϯςφӡ༻
,VCFSOFUFTΛθϩ͔Βߏங͠ ӡ༻͢ΔͷͱͯେมͰ͢
.BTUFS/PEF,VCFSOFUFTΫϥελશମͷ੍ޚ"1*Λఏڙ͢Δαʔό /PEF։ൃऀ͕σϓϩΠ͢Δ1PEͷϦιʔε͕ஔ͞ΕΔαʔό
ӡ༻ʹඞཁͳ࡞ۀΞϨίϨ ‣ ,VCFSOFUFTΫϥελͷߏங࡞ۀ ‣ LVCFTQSBZ LPQTͷπʔϧ͕͋Δ͕ɺͦΕͰ؆୯Ͱͳ͍ ‣ Ϛελʔϊʔυͷཧ͕ඞཁ ‣ ,VCFSOFUFTΫϥελͷόʔδϣϯΞοϓ࡞ۀ
‣ *OHSFTT$POUSPMMFS"VUPTDBMJOHɺӡ༻ʹඞཁͳΈΛηο τΞοϓ͢Δඞཁ͕͋Δ ‣ ϞχλϦϯάࣗલͰηοτΞοϓ
,VCFSOFUFT ϚωʔδυαʔϏεΛ͓͏
දతͳϚωʔδυαʔϏε ‣ (PPHMF,VCFSOFUFT&OHJOF (,& ‣ "NB[PO&MBTUJD$POUBJOFS4FSWJDFGPS,VCFSOFUFT &,4 ‣
౦ژϦʔδϣϯ·ͩະରԠ ‣ LTͰͳ͍ίϯςφϚωʔδυαʔϏε &$4 ͋Δ ‣ "[VSF,VCFSOFUFT4FSWJDF ",4
ϚωʔδυαʔϏεͷྑ͍ͱ͜Ζ ‣ ,VCFSOFUFTΫϥελߏங͕ࣗಈ ‣ Ϛελʔϊʔυͷཧ͕ෆཁ ‣ ΫϥελͷόʔδϣϯΞοϓ͓·͔ͤ ‣ ϓϥοτϑΥʔϜผͷαʔϏεͱɺੑͷߴ͍࿈ܞ͕Ͱ͖Δ ‣
*OHSFTTϩʔυόϥϯαʔͱͷ࿈ܞɹ ‣ "VUPTDBMJOHͰͷϊʔυ૿ݮʹͪΖΜରԠ ‣ ϩάͷӾཡϞχλϦϯάʹରԠ ‣ ։ൃऀʹͱͬͯຊ࣭తͰͳ͍࡞ۀϚωʔδυ͕ߦ
(,&Ͱͷཧը໘
Ϛωʔδυͷબ(,&͕ݱ࣮త ‣ LT։ൃΛओಋ͢Δ(PPHMFʹΑΔϚωʔδυαʔϏεͰ͋Δ ‣ ",4&,4(,&ʹൺɺΕΛऔ͍ͬͯΔ෦͕ଟ͍ ‣ ػೳ໘ཧը໘ͷૢ࡞ੑɹ ‣ ಛघͳཧ༝͕ͳ͍ݶΓɺ(,&Λબ͢Δ͜ͱΛ͓͢͢Ί͠·͢
ίϯςφӡ༻Λࢧ͑Δπʔϧ
ίϯςφӡ༻Λࢧ͑Δπʔϧ ‣ &MBTUJDTFBSDI ,JCBOB ‣ TUBDLESJWFS ‣ TUFSO
&MBTUJDTFBSDI ,JCBOB ‣ &MBTUJDTFBSDI ‣ શจݕࡧΤϯδϯ ‣ ίϯςφͷϩάΛอଘ͢ΔͨΊʹར༻ ‣ ,JCBOB
‣ ϩάσʔλՄࢹԽπʔϧ ‣ &MBTUJDTFBSDIʹอ࣋͞ΕͨϩάσʔλΛӾཡͰ͖Δ
ϩάऩूͷΈ
LJCBOBͰϩάӾཡ
TUBDLESJWFSͰͷϩά֬ೝ
TUFSO ‣ ίϚϯυϥΠϯͰɺ,VCFSOFUFTͷ1PE͕ग़ྗ͢ΔϩάΛUBJM͢ ΔͨΊͷπʔϧ ‣ IUUQTHJUIVCDPNXFSDLFSTUFSO ‣ ࢦఆͨ͠ϥϕϧʹώοτ͢Δ1PEͷϩάʹߜΓࠐΊΔ
·ͱΊ
·ͱΊ ‣ %PDLFSܾͯ͠ΠϯϑϥدΓͷٕज़Ͱͳ͘ɺΞϓϦέʔγϣ ϯͷσϓϩΠʹಛԽٕͨ͠ज़ ‣ ϙʔλϏϦςΟʹຬͪͨɺ%PDLFSϑϨϯυϦͳΠϝʔδΛͭ͘ Δ͜ͱʹՁ͕͋Δ ‣ ༷ʑͳ,VCFSOFUFTϦιʔεΛΈ߹ΘͤͯɺΞϓϦέʔγϣϯ ΛσϓϩΠ͢Δ
‣ ϚωʔδυαʔϏεʹཔΖ͏ʂʢಛʹཧ༝͕ͳ͚Ε(,&ʣ ‣ ίϯςφ։ൃΛࢧԉ͢Δɺ༷ʑͳπʔϧ͕ॆ࣮͍ͯ͠·͢
5IBOLT✋