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

入門、Kubernetes Persistent Volume

入門、Kubernetes Persistent Volume

Kubernetes Meetup Tokyo#25での発表資料です。

Yukinori Sakashita

November 13, 2019
Tweet

More Decks by Yukinori Sakashita

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ ‣ٕज़ݚڀΤϦΞ  ӡ༻؅ཧٕज़  Ϋϥ΢υ  αʔόετϨʔδ  ࣗಈࣗ཯ίϯϐϡʔςΟϯά

     "*.- // ).. #BZFTJBO/FUXPSL  ‣৬ྺ  ૯߹ిػϝʔΧʔ 㾎ݚڀॴ ओ೚ݚڀһ  㾎ւ֎ݚڀॴ!γϦίϯόϨʔ ϥϘ௕   αʔόϕϯμʔ ςΫχΧϧ4& 2 ࡔԼ޾ಙ ത࢜  :VLJOPSJ4BLBTIJUB 1I% ‣ ϠϑʔגࣜձࣾθοτϥϘגࣜձࣾ ‣ 4/*"೔ຊࢧ෦ٕज़ҕһձ෭ҕһ௕ ‣ 4/*" 64 5FDIOJDBM$PVODJM"EWJTPS
  2. ॳ৺ऀ͕ࠞಉ͠΍͍͢ϫʔυ 5 3FBE 8SJUF ϒϩοΫ ϑΝΠϧ ΦϒδΣΫτ 4$4* J4$4* $JOEFS

    /7.F P' $4* 1SPWJTJPOJOH "UUBDI %FUBDI 4XPSEpTI ؅ཧ"1* 4"/ σʔλϓϨʔϯʹؔ࿈͢Δϫʔυ ίϯτϩʔϧϓϨʔϯʹؔ࿈͢Δϫʔυ ‣ σʔλϓϨʔϯσʔλ֨ೲͱసૹॲཧΛ୲͏ ‣ ίϯτϩʔϧϓϨʔϯ؅ཧ"1*ͳͲͷॲཧΛ୲͏
  3. ϒϩοΫετϨʔδ ϑΝΠϧετϨʔδ ΦϒδΣΫτετϨʔδ ΞʔΩςΫνϟ ಛ௃ w಺ଂυϥΠϒͱಉ͡3BXσόΠε wϑΝΠϧγεςϜ͸ࣗ༝ʹબ୒ wωοτϫʔΫυϥΠϒ wϑΝΠϧγεςϜ͸ετϨʔδ೚ ͤɺมߋෆՄ

    wΦϒδΣΫτ୯ҐͰΞΫηε wϑΝΠϧγεςϜʹґଘ͠ͳ͍ ͨΊɺେྔσʔλΛ֨ೲՄೳ σʔλసૹϓϩτίϧ J4$4* '$ /7.F /'4 4.# )5514 )551 Ϛ΢ϯτύεͷྫ EFWTEB aaaTIBSFaIPHF IUUQTBBBPSHTUPSBHFIPHF ੑೳ )JHI .JEEMF -PX ओͳ༻్ %# 04 #PPU%JTL ϑΝΠϧͷڞ༗ ࣸਅɺಈը֨ೲ ετϨʔδछผ 6 J4$4* /"44FSWFS /'4 4.# ,74 )55144FSWFS )5514 )PTU )PTU )PTU Ұൠతͳ܏޲Ͱ͋Γ੡඼ʹΑΓมΘΓ·͢ 4$4* 4$4*
  4. 1FSTJTUFOUͱ͸ ‣ &QIFNFSBM ͸͔ͳ͍ɺ୹໋   1PEͷ࡟আ࠶σϓϩΠͱಉ࣌ʹσʔλ͕ফ͑Δ  FNQUZ%JS7PMVNF MPHEJSFDUPSZ

    XSJUBCMFMBZFST ‣ 1FSTJTUFOU ࣋ଓతɺӬଓੑ   1PE͕࡟আ࠶σϓϩΠ͞Εͯ΋σʔλ͸ফ͑ͳ͍  1FSTJTUFOU7PMVNF 17 8 bin/lib Container App Logic Data
  5. ‣ ,VCFSOFUFTW `   $4* "MQIB  ‣ ,VCFSOFUFTW

    `   -PDBM7PMVNF #FUB  ‣ ,VCFSOFUFTW `   7PMVNF3FTJ[JOH ‣ ,VCFSOFUFTW `   7PMVNF4OBQTIPU "MQIB   5PQPMPHZ"XBSF7PMVNF 1SPWJTJPOJOH #FUB 11 ‣ ,VCFSOFUFTW `   $4* ("  ‣ ,VCFSOFUFTW `   -PDBM7PMVNF ("  ‣ ,VCFSOFUFTW `   $4*7PMVNF$MPOJOH "MQIB  ‣ ,VCFSOFUFTW `   $4*7PMVNF$MPOJOH #FUB ,VCFSOFUFTͰͷαϙʔτػೳཤྺ
  6. ετϨʔδͷϞσϧ ‣ ϕϯμʔχϡʔτϥϧͳϞσϧ  1FSTJTUFOU7PMVNF$MBJN  1FSTJTUFOU7PMVNF  4UPSBHF$MBTT ‣

    ؅ཧऀͱϢʔβͷ໾ׂΛߟྀͨ͠Ϟσϧ ‣ ετϨʔδ૷ஔͷૢ࡞ͳ͠Ͱ7PMVNFΛ
 ίϯςφʹࣗಈͰϚ΢ϯτ ‣ ओʹϒϩοΫετϨʔδϑΝΠϧ
 ετϨʔδ͕ର৅ 12 Ϣʔβ ؅ཧऀ
  7. ετϨʔδϦιʔεͷൣғͱݖݶ ‣ 4UPSBHF$MBTT 1FSTJTUFOU7PMVNF͸શͯͷ/BNFTQBDFͰڞ௨ͷϦιʔε  Ϋϥελશମͷ؅ཧऀݖݶ͕ඞཁ  $MVTUFS3PMFͱόΠϯσΟϯά͞ΕͨΞΧ΢ϯτ ‣ 1FSTJTUFOU7PMVNF$MBJN͸/BNFTQBDF͝ͱͷϦιʔε

     /BNFTQBDFEΦϒδΣΫτ΁ͷಡΈॻ͖ͷݖݶ͕ඞཁ  3PMFͱόΠϯσΟϯά͞ΕͨΞΧ΢ϯτ 13 LVCFDUMBQJSFTPVSDFT /".&4)035/".&4"1*(3061/".&41"$&%,*/% QFSTJTUFOUWPMVNFDMBJNTQWDUSVF1FSTJTUFOU7PMVNF$MBJN QFSTJTUFOUWPMVNFTQWGBMTF1FSTJTUFOU7PMVNF TUPSBHFDMBTTFTTDTUPSBHFLTJPGBMTF4UPSBHF$MBTT
  8. ϩοΫϝΧχζϜͷҧ͍ ‣ ϒϩοΫετϨʔδ  -#" ࿦ཧϒϩοΫΞυϨογϯά ͷΞΫηε ͷͨΊɺϩοΫϝΧχζϜΛ͍࣋ͬͯͳ͍  ୆ͷϗετ͔ΒͷΈ8SJUFͱͳΔΑ͏ʹ


    Ϛ΢ϯτ͢Δඞཁ͋Γ ‣ ϑΝΠϧετϨʔδ  ϑΝΠϧ୯ҐͰͷϩοΫϝΧχζϜ͋Γ  0QFO࣌ʹऔಘͨ͠ϩοΫΛଞϗετʹ΋఻ൖ  ෳ਺୆ͷϗετ͔Β3FBE8SJUF͕Մೳ 15 )PTU )PTU )PTU )PTU 3FBE8SJUF 3FBE 3FBE8SJUF 3FBE8SJUF )PTU ͕ഉଞϩοΫͰ ։͍͍ͯΔΑ pMF ϒϩοΫετϨʔδ ϑΝΠϧετϨʔδ
  9. "DDFTT.PEFT 16 /PEF /PEF 3FBE 3FBE 3FBE8SJUF0ODF 380 3FBE0OMZ.BOZ 309

    /PEF /PEF 3FBE8SJUF.BOZ 389 ‣ ͭͷ/PEF͔Β3FBE 8SJUFͰϚ΢ϯτͰ͖Δ ‣ ෳ਺ͷ/PEF͔Β3FBE 0OMZͰϚ΢ϯτͰ͖Δ ‣ ෳ਺ͷ/PEF͔Β3FBE 8SJUFͰϚ΢ϯτͰ͖Δ /PEF 3FBE8SJUF 3FBE8SJUF 3FBE8SJUF
  10. 1FSTJTUFOU7PMVNF QW ‣ 7PMVNFΛද͢Ϧιʔε  4UPSBHFUZQF 4UPSBHF$MBTT໊   4J[F

     "DDFTTNPEFT  3FDMBJNQPMJDZ w 3FUBJO w 3FDZDMF w %FMFUF 17
  11. $4* $POUBJOFS4UPSBHF*OUFSGBDF ‣ ίϯςφΦʔέετϨʔγϣϯ޲͚ͷඪ४࢓༷ ‣ ೥݄ʹ࠷ॳͷύϒϦοΫϦϦʔε ‣ ओཁͳίϯςφΦʔέετϨʔγϣϯ͕࠾༻
 ,VCFSOFUFT $MPVE'PVOESZ

    .FTPT %PDLFS FUD  ‣ ,VCFSOFUFTͰ͸ʹͯ("αϙʔτ ‣ ,VCFSOFUFTͷιʔεπϦʔ JOUSFF Ͱ؅ཧ͞Ε͍ͯͨετϨʔδ૷ஔʹ
 ؔ࿈͢Δ࣮૷͕ɺSEϕϯμͰಠࣗʹ։ൃఏڙ͢Δ͜ͱ͕Մೳ 20
  12. 4UBUFGVM4FU TUT  21 ‣ 1FSTJTUFOU7PMVNF 1FSTJTUFOU7P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DDFTT.PEFT<3FBE8SJUF0ODF> TUPSBHF$MBTT/BNFHPME SFTPVSDFT SFRVFTUT TUPSBHF(J 4FMFDU4$
  16. %ZOBNJD1SPWJTJPOJOH 26 ʜ TQFD DPOUBJOFST OBNFNZTRM JNBHFNZTRM ʜ WPMVNF.PVOUT OBNFNZTRMEBUB

    NPVOU1BUIWBSMJCNZTRM WPMVNF$MBJN5FNQMBUFT NFUBEBUB OBNFNZTRMEBUB TQFD BDDFTT.PEFT<3FBE8SJUF0ODF> TUPSBHF$MBTT/BNFHPME SFTPVSDFT SFRVFTUT TUPSBHF(J Storage $SFBUF7PMVNF QSPWJTJPOFS
  17. %ZOBNJD1SPWJTJPOJOH 27 ʜ TQFD DPOUBJOFST OBNFNZTRM JNBHFNZTRM ʜ WPMVNF.PVOUT OBNFNZTRMEBUB

    NPVOU1BUIWBSMJCNZTRM WPMVNF$MBJN5FNQMBUFT NFUBEBUB OBNFNZTRMEBUB TQFD BDDFTT.PEFT<3FBE8SJUF0ODF> TUPSBHF$MBTT/BNFHPME SFTPVSDFT SFRVFTUT TUPSBHF(J Storage OS "TTJHO $SFBUF
 17
  18. %ZOBNJD1SPWJTJPOJOH 28 ʜ TQFD DPOUBJOFST OBNFNZTRM JNBHFNZTRM ʜ WPMVNF.PVOUT OBNFNZTRMEBUB

    NPVOU1BUIWBSMJCNZTRM WPMVNF$MBJN5FNQMBUFT NFUBEBUB OBNFNZTRMEBUB TQFD BDDFTT.PEFT<3FBE8SJUF0ODF> TUPSBHF$MBTT/BNFHPME SFTPVSDFT SFRVFTUT TUPSBHF(J Storage OS Container Runtime Container .PVOU
 ɹ17
  19. Ϛωʔδυ,4ͷετϨʔδ 35 (,& (PPHMF &,4 "NB[PO ",4 .4 ϒϩοΫ ϑΝΠϧ

    ϒϩοΫ ϑΝΠϧ ϒϩοΫ ϑΝΠϧ 7PMVNF ($&1FSTJTUFOU%JTL $MPVE'JMFTUPSB "NB[PO&#4 "NB[PO&'4 "[VSF%JTL "[VSF'JMF "DDFTT
 .PEF 380 309 380 309 389 380 309 380 309 389 380 380
 309 389 ಛ௃ w 44%PS)%%ͷ
 બ୒Մ w ϦʔδϣϯӬଓ
 σΟεΫ ϕʔλ w /'4W w *OUSFFͷ/'4 ͔Β࢖༻ w൚༻44% HQ ɺ
 ߴੑ44% JP ɺ ൚༻)%% TU ɺ
 $PME)%% TD ͷબ୒Մ w/'4W w$4*͔Β࢖༻ w 44%PS)%% ͷબ୒Մ w4.# w*OUSFF$4*͔Β ࢖༻ w"[VSF'JMFͱ "[VSF/FU"QQ 'JMFͷબ୒Մ .BY
 17/PEF      
  20. (,&Ͱ1FSTJTUFOU7PMVNFΛ࢖͏ ‣ (,&Ͱ,VCFSOFUFTΫϥελΛηοτΞοϓ  σϑΥϧτͰϒϩοΫετϨʔδͷ4UPSBHF$MBTT lTUBOEBSEz ͕
 σϓϩΠࡁΈ  σϑΥϧτͷσΟεΫλΠϓ͸QETUBOEBSE

    )%%   มߋ͍ͨ͠৔߹͸4UPSBHF$MBTTΛฤूPS৽ͨʹσϓϩΠ 36 LVCFDUMHFUTD /".&1307*4*0/&3"(& TUBOEBSE EFGBVMU LVCFSOFUFTJPHDFQENT
  21. (,&Ͱ1FSTJTUFOU7PMVNFΛ࢖͏ ‣ 17$ͷ.BOJGFTUΛ࡞੒σϓϩΠ 37 BQJ7FSTJPOW LJOE1FSTJTUFOU7PMVNF$MBJN NFUBEBUB OBNFUFTUWPM TQFD TUPSBHF$MBTT/BNFTUBOEBSE

    BDDFTT.PEFT 3FBE8SJUF0ODF SFTPVSDFT SFRVFTUT TUPSBHF(J LVCFDUMBQQMZGQWDZBNM QFSTJTUFOUWPMVNFDMBJNUFTUWPMDSFBUFE QWDZBNM
  22. (,&Ͱ1FSTJTUFOU7PMVNFΛ࢖͏ ‣ 17$Λࢦఆͨ͠1PEͷ.BOJGFTUΛ
 ࡞੒ˍσϓϩΠ 39 BQJ7FSTJPOW LJOE1PE NFUBEBUB OBNFUFTUQPE TQFD

    DPOUBJOFST JNBHFOHJOY OBNFUFTUQPE WPMVNF.PVOUT NPVOU1BUIVTSTIBSFOHJOYIUNM OBNFEBUBWPM WPMVNFT OBNFEBUBWPM QFSTJTUFOU7PMVNF$MBJN DMBJN/BNFUFTUWPM LVCFDUMBQQMZGQPEZBNM QPEUFTUQPEDSFBUFE QPEZBNM ‣ Ϛ΢ϯτ͞Ε͍ͯΔ͔Λ֬ೝ LVCFDUMFYFDUFTUQPEEGcHSFQOHJOY EFWTECVTSTIBSFOHJOYIUNM
  23. ετϨʔδ͸ԿΛબΜͩΒྑ͍ʁ ‣ ࣍ͷج४Λߟ͑બผ͢Δͷ͕Φεεϝ ‣ ֨ೲ͍ͨ͠σʔλͷՁ஋͸ʁ ‣ ར༻͢ΔΞϓϦέʔγϣϯͷछྨ͸ʁ ‣ 044ͷετϨʔδͷ৔߹ɺো֐ൃੜ࣌ʹιʔεͷϝϯς͕ԿਓͰ͖Δ͔ʁ ‣

    044ͷετϨʔδͷ৔߹ɺো֐ൃੜ࣌ʹอূͯ͘͠Εͳ͍ͷͰ࠷ѱσʔλ͕ফ ͑Δ͜ͱ΋ࢹ໺ʹೖΕͯར༻ϢʔεέʔεΛݟఆΊ ‣ ετϨʔδΛબͿ࣌ɾγεςϜઃܭ͢Δͱ͖ʹߟྀ͢΂͖ϙΠϯτ͸ʁ  ࣦഊ͠ͳ͍,VCFSOFUFT޲͚ετϨʔδબͼͭͷϙΠϯτ $/%5 
 IUUQTTQFBLFSEFDLDPNZTBLBTIJUBTIJCBJTJOBJLVCFSOFUFTYJBOHLFTVUPSF[JYVBOCJUVGBMTFQPJOUP
  24. %FQMPZNFOUͰ17Λ࢖ͬͯྑ͍ʁ ‣ %FQMPZNFOU͸ετϨʔδʹ༏͘͠ͳ͍ͷͰ4UBUFGVM4FU͕Φεεϝ ‣ ಛʹ389Λαϙʔτ͍ͯ͠ͳ͍ετϨʔδͰ͸4UBUFGVM4FU %FUBDIલ 38 "UUBDIΛࢼΈΔɻ
 ͔͠͠ผ/PEFͰ38 Ͱ"UUBDIࡁͷͨΊ


    3FBE0OMZͰϚ΢ϯτ PSΤϥʔ 3 3PMMJOH 6QEBUF FUD 5FSNJOBUJOH $SFBUJOH ಉ࣌ʹൃੜ ಉ࣌ʹൃੜ ࢀߟIUUQTDMPVEHPPHMFDPNLVCFSOFUFTFOHJOFEPDTDPODFQUTQFSTJTUFOUWPMVNFT IMKBEFQMPZNFOUT@WT@TUBUFGVMTFUT
  25. ·ͱΊ 45 ‣ ετϨʔδͷೖ໳ͱͯ͠ϒϩοΫɺϑΝΠϧɺΦϒδΣΫτͷҧ͍Λ঺հ ‣ ,VCFSOFUFTͰͷετϨʔδͷϞσϧͱಈ͖Λ঺հ  17$ 17 4$

     %ZOBNJD1SPWJTJPOJOHͱ3PMMJOH6QEBUFͰͷಈ͖  Ϛωʔδυ,VCFSOFUFTͰͷετϨʔδ ‣ Α͋͘Δ࣭໰ͱͦͷճ౴ͷ঺հ