Pro Yearly is on sale from $80 to $50! »

PersistentVolumeの一歩進んだ使い方

 PersistentVolumeの一歩進んだ使い方

CloudNative Days Tokyo2020 での発表資料です。

https://event.cloudnativedays.jp/cndt2020/talks/13

17d762ae166e66cab39e9b2e3df7d198?s=128

Yukinori Sakashita

September 09, 2020
Tweet

Transcript

  1. 1FSTJTUFOU7PMVNFͷ ҰาਐΜͩ࢖͍ํ :VLJOPSJ4BLBTIJUB

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

     "*.- // ).. #BZFTJBO/FUXPSL  ‣લ৬  ೔ཱ੡࡞ॴ 㾎தԝݚڀॴԣ඿ݚڀॴ ओ೚ݚڀһ  㾎ւ֎ݚڀॴ!γϦίϯόϨʔ ϥϘ௕   αʔόϕϯμʔ ςΫχΧϧ4& 2 ࡔԼ޾ಙ ത࢜  :VLJOPSJ4BLBTIJUB 1I% ‣ ϠϑʔגࣜձࣾθοτϥϘגࣜձࣾ ‣ 4/*"೔ຊࢧ෦ٕज़ҕһձ෭ҕһ௕ ‣ 4/*"5FDIOJDBM$PVODJM"EWJTPS
  3. ओͳॻ੶8FCهࣄߨԋ ‣ ॻ੶,VCFSOFUFT࣮ફೖ໳ ग़൛  ‣ 8FCهࣄ5IJOL*5  ίϯςφΛಋೖ͠ͳ͍ͱɺͲͷΑ͏ͳະདྷ͕ ଴͍ͬͯͨͷ͔

        ݱ৔Ͱ໾ཱͭ5JQT͕੝Γͩ͘͞Μ ,VCFSOFUFTͷΞϨ΍ίϨ    ‣ ߨԋ  ߴ஌޻Պେֶ৘ใֶ܈ಛผߨٛʮσʔλͷരൃత૿ՃΛ ࢧ͑ΔετϨʔδͷઌ୺ٕज़ͱࠃࡍඪ४Խʯ    ,VCF'FTU5PLZPʮϠϑʔθοτϥϘͷ εςʔτϑϧΞϓϦέʔγϣϯ΁ͷ௅ઓʯ  3
  4. "HFOEB ‣ ,VCFSOFUFTͰΞϓϦέʔγϣϯΛ࣮ߦ͢ΔϢʔβ޲͚  7PMVNF&YQBOTJPO  7PMVNF4OBQTIPU  7PMVNF$MPOJOH ‣

    ,VCFSOFUFTΛఏڙ͢Δ؅ཧऀ޲͚  5PQPMPHZ .VMUJ";3FHJPO   .POJUPSJOH 4 ؔ࿈ൃද,VCFSOFUFT.FFUVQ5PLZPlೖ໳ɺ,VCFSOFUFT1FSTJTUFOU7PMVNFz IUUQTTQFBLFSEFDLDPNZTBLBTIJUBSVNFOLVCFSOFUFTQFSTJTUFOUWPMVNF
  5. 7PMVNF&YQBOTJPO Ϣ ʔ β ޲ ͚

  6. 7PMVNF&YQBOTJPOͱ͸ ‣ 1FSTJTUFOU7PMVNF 17 ͷαΠζΛ૿΍͢ػೳ ॖখ͸ෆՄ  ‣ ετϨʔδͷ7PMVNFͷαΠζͱ'JMF4ZTUFNͷαΠζΛಉ࣌ʹ֦ு ‣

    4UPSBHF$MBTTʹBMMPX7PMVNF&YQBOTJPOUSVFΛઃఆ ‣ 1PEͷ࠶࡞੒͕ෆཁͳ0OMJOF ‣ 1PEͷ࠶࡞੒͕ඞཁͳ0⒐JOF 6 ( ( BQJ7FSTJPOTUPSBHFLTJPW LJOE4UPSBHF$MBTT ʜ BMMPX7PMVNF&YQBOTJPOUSVF 4UPSBHF$MBTTͷઃఆྫ
  7. มߋՕॴ ‣ 1FSTJTUFOU7PMVNF$MBJN 17$ ͷαΠζΛมߋ 7 BQJ7FSTJPOW LJOE1FSTJTUFOU7PMVNF$MBJN NFUBEBUB OBNFQWD

    TQFD TUPSBHF$MBTT/BNFTUBOEBSE BDDFTT.PEFT 3FBE8SJUF0ODF SFTPVSDFT SFRVFTUT TUPSBHF(J BQJ7FSTJPOW LJOE1FSTJTUFOU7PMVNF$MBJN NFUBEBUB OBNFQWD TQFD TUPSBHF$MBTT/BNFTUBOEBSE BDDFTT.PEFT 3FBE8SJUF0ODF SFTPVSDFT SFRVFTUT TUPSBHF(J
  8. ࣮ߦྫ 8 $ kubectl get pvc NAME STATUS VOLUME CAPACITY

    ・・・ test-pvc Bound pvc-5452b84e-56e0-43cf-ada9-7491fd3ae2d4 10Gi $ kubectl patch pvc test-pvc -p "{\"spec\":{\"resources\":{\"requests\":{\"storage\": \"50Gi\"}}}}" $ kubectl get pvc NAME STATUS VOLUME CAPACITY ・・・ test-pvc Bound pvc-5452b84e-56e0-43cf-ada9-7491fd3ae2d4 50Gi มߋ
  9. 9 ҰาਐΜͩ࿩

  10. 4UBUFGVM4FUͰ͸ཁ஫ҙ ‣ 7PMVNF$MBJN5FNQMBUF͔Β࡞੒͞Εͨ17$ͷαΠζ͸มߋՄೳ ‣ ͔͠͠ɺσϓϩΠ͞Εͨ4UBUFGVM4FUͷ7PMVNF$MBJN5FNQMBUFT͸มߋෆՄ ‣ (JU)VCͳͲͰ.BOJGFTUΛ؅ཧ͍ͯ͠Δ৔߹͸ζϨ͕ੜ͡ͳ͍Α͏ʹ஫ҙ 10 BQJ7FSTJPOBQQTW LJOE4UBUFGVM4FU

    ʜ WPMVNF$MBJN5FNQMBUFT NFUBEBUB OBNFCMPDL TQFD BDDFTT.PEFT<3FBE8SJUF0ODF> TUPSBHF$MBTT/BNFTUBOEBSE SFTPVSDFT SFRVFTUT TUPSBHF( มߋ͍ͨ͠ "QQMZ ࢀߟ ,&1IUUQTHJUIVCDPNLVCFSOFUFTFOIBODFNFOUTJTTVFT *TTVFIUUQTHJUIVCDPNLVCFSOFUFTLVCFSOFUFTJTTVFT
  11. 8PSLBSPVOE ‣ 4UBUFGVM4FUΛDBTDBEFΦϓγϣϯͰҰ࣌࡟আ ‣ खॱྫ  LVCFDUMQBUDIίϚϯυͳͲͰطଘͷ17$ͷαΠζΛมߋ  4UBUFGVM4FUͷ.BOJGFTUϑΝΠϧ಺ͷWPMVNF$MBJN5FNQMBUFTͷαΠζΛ खॱͱಉ͡αΠζʹมߋ

     DBTDBEFΦϓγϣϯͰ4UBUFGVM4FUΛҰ࣌࡟আ ࡞੒ࡁΈͷ1PE 17$ 17͸࡟আ͞Εͳ͍   ࠶౓ɺखॱͰมߋͨ͠.BOJGFTUϑΝΠϧΛ"QQMZ 11 $ kubectl delete sts —cascade=false <StatefulSet name>
  12. 8PSLBSPVOE ஫ҙ఺ ‣ खॱͱͷؒ͸4UBUFGVM4FUͷϦιʔε͕ଘࡏ͠ͳ͍ ‣ ͜ͷؒʹো֐͕ൃੜ͢ΔͱηϧϑώʔϦϯάͰͷ෮چ͠ͳ͍ ‣ खॱͱ͸ؒ൅ೖΕͣʹ࣮ߦ͢Δͷ͕͓קΊ 12

  13. 8PSLBSPVOE ‣ 7PMVNF$MBJN5FNQMBUFTͰࣗಈੜ੒͞ΕΔ17$ͱ ಉ໊͡લͷ17$ͷ.BOJGFTUϑΝΠϧΛ༻ҙ ‣ 17$ͷ.BOJGFTUϑΝΠϧͰαΠζΛมߋ ‣ 4UBUFGVM4FUͷ7PMVNF$MBJN5FNQMBUFTͷαΠζ͸มߋ͠ͳ͍ͨΊɺ ৽نʹ࡞੒͞ΕΔ17$17͸ݩͷαΠζͷͨΊཁ஫ҙ ‣

    17$ͷ.BOJGFTUϑΝΠϧΛผ్࡞੒͢Δඞཁ͕͋Γ 4UBUFGVM4FUͷ7PMVNF$MBJN5FNQMBUFTͷϝϦοτ͕൒ݮ 13
  14. 17ͷ҆શͳαΠζ ‣ 7PMVNF&YQBOTJPO͸ɺ࠷ऴखஈ͙Β͍ͷҙࣝͰαΠζΛࣄલʹઃܭ ‣ ετϨʔδͰ5IJO1SPWJTJPOJOH͕αϙʔτͷ৔߹ɺαΠζͷେ͖ͳ17 Λ༧Ί࡞੒  5IJO1SPWJTJPOJOH͸࣮ࡍͷॻ͖ࠐ·ΕͨྖҬͷΈ ෺ཧϝσΟΞ 44%ɺ)%%

    Λফඅ ‣ 4UBUFGVM4FUͰͷ7PMVNF&YQBOTJPO͸8PSLBSPVOE͕͓קΊ   8PSLBSPVOEͷ࣮ࢪத͸(JU0QT่͕Εͯ͠·͏͕ɺҎ߱͸(JU0QT͕ܧଓ  8PSLBSPVOE͸4UBUFGVM4FUͰεέʔϧΞ΢τલʹ17$ͷ.BOJGFTUΛ࡞੒ ͢Δඞཁ͋Γ ๨ΕΔͱ17ͷσʔλᷓΕͷࣄނʹͭͳ͕ΔϦεΫ͋Γ 14
  15. 7PMVNF4OBQTIPU Ϣ ʔ β ޲ ͚

  16. 4OBQTIPUͱ͸ ετϨʔδͷ஌ࣝ ‣ 4OBQTIPUΛ࡞੒ͨ࣌͠ࠁͷσʔλΛอଘ͢Δػೳ 16 " 5JNF # # "`

    $ $    "Λ"`ʹ ॻ͖׵͑ 4OBQTIPU 7PMVNF   " " # $   " # $ #`   "` 4OBQTIPU࡞੒ 4PVSDF 4OBQTIPU࡞੒ #Λ#`ʹ ॻ͖׵͑ ࠩ෼σʔλͷ อଘྖҬ $P8 $PQZPO8SJUF ʹ ΑΔࠩ෼όοΫΞοϓ "`
  17. ,VCFSOFUFTͷ7PMVNF4OBQTIPU ‣ 7PMVNF4OBQTIPU͸ͭͷϦιʔεͰදݱ  7PMVNF4OBQTIPU4OBQTIPUͷཁٻ࢓༷  7PMVNF4OBQTIPU$POUFOU4OBQTIPUͷίϯςϯπ ࠩ෼σʔλͷू߹  

    7PMVNF4OBQTIPU$MBTT4OBQTIPU༻ͷ4UPSBHF$MBTT ͷΑ͏ͳ΋ͷ  ‣ 7PMVNF4OBQTIPUϦιʔεΛ࡞੒͢Δ͜ͱͰετϨʔδ಺Ͱ4OBQTIPU͕࣮ߦ ‣ 7PMVNF4OBQTIPU$POUFOUϦιʔε͸ࣗಈੜ੒ 17
  18. 7PMVNF4OBQTIPU 18 BQJ7FSTJPOTOBQTIPUTUPSBHFLTJPWCFUB LJOE7PMVNF4OBQTIPU NFUBEBUB OBNFTOBQTIPUQWD TQFD WPMVNF4OBQTIPU$MBTT/BNFDTJTOBQTIPU TPVSDF QFSTJTUFOU7PMVNF$MBJN/BNFUFTUQWD

     UFTUQWD TOBQTIPUQWD ࢦఆ .BOJGFTUͷ"QQMZ 4OBQTIPU࣮ߦ
  19. 3FTUPSF ‣ 7PMVNF4OBQTIPU͔Βͷ3FTUPSF͸17$Λ࡞੒͢Δ͜ͱͰ࣮ࢪ 19 BQJ7FSTJPOW LJOE1FSTJTUFOU7PMVNF$MBJN NFUBEBUB OBNFQWDGSPNTOBQTIPU TQFD BDDFTT.PEFT

    3FBE8SJUF0ODF TUPSBHF$MBTT/BNFTUBOEBSE SFTPVSDFT SFRVFTUT TUPSBHF(J EBUB4PVSDF BQJ(SPVQTOBQTIPUTUPSBHFLTJP LJOE7PMVNF4OBQTIPU OBNFTOBQTIPUQWD  QWDGSPNTOBQTIPU TOBQTIPUQWD .BOJGFTUͷ"QQMZ 3FTUPSF࣮ߦ
  20. 20 ҰาਐΜͩ࿩

  21. ݩͷ17ͷඞཁੑ ‣ ετϨʔδͷ4OBQTIPU͸ࠩ෼σʔλͷΈอଘ ‣ 4OBQTIPUதͷࠩ෼σʔλ΁ͷΞΫηε͸ݪଇ3FBE0OMZ ‣ ݩͷ7PMVNFΛ࡟আ͢Δͷ͸/( ‣ ,VCFSOFUFTͷ7PMVNF4OBQTIPUʹ͓͍ͯ΋ݩͷ17$17͸࡟আͯ͠͸/( ‣

    ໰୊  3FTUPSFͨ͠ޙͰ͋Ε͹ɺ࢖Θͳ͘ͳͬͨݩͷ17$17͸࡟আͯ͠΋ྑ͍͔ʁ 21
  22. ݩͷ17ͷඞཁੑ ଓ͖ ‣ ౴͑  ར༻͢ΔετϨʔδʹΑΓ·͢ 22 # "` $

    " 3FBE8SJUF 3FBE8SJUF # "` $ " ݩͷ7PMVNF 4OBQTIPU 3FBE8SJUF 3FBE # "` $ " 3FBE8SJUF 3FBE8SJUF # $ 4OBQTIPUத 8SJUBCMF4OBQTIPUΛ࢖༻ $MPOFͰ৽ن7PMΛ࡞੒ ݩͷ17͸ ࡟আ/( ݩͷ17͸ ࡟আ0, 3FTUPSF " 3FBE
  23. 7PMVNF$MPOJOH Ϣ ʔ β ޲ ͚

  24. $MPOFͱ͸ ετϨʔδͷ஌ࣝ ‣ ݩͷ7PMVNFͷෳ੡ Ϋϩʔϯ Λ࡞੒ ‣ ݩͷ7PMVNFΑΓখ͞ͳ7PMVNF΁͸$MPOFͰ͖ͳ͍ ‣ ετϨʔδͰߦΘΕΔͨΊɺαʔόͷ$16.FNPSZ/FUXPSLΛ࢖Θͳ͍

    24 # $ " # $ " 7PMVNF" 7PMVNF"` $MPOJOH
  25. ,VCFSOFUFTͷ7PMVNF$MPOJOH ‣ 17$ͷEBUB4PVSDFʹΫϩʔϯݩͷ17$Λࢦఆ ‣ όοΫΞοϓ༻్ͳͲʹར༻ 25 BQJ7FSTJPOW LJOE1FSTJTUFOU7PMVNF$MBJN NFUBEBUB OBNFQWD

    TQFD BDDFTT.PEFT 3FBE8SJUF0ODF TUPSBHF$MBTT/BNFTUBOEBSE SFTPVSDFT SFRVFTUT TUPSBHF(J EBUB4PVSDF LJOE1FSTJTUFOU7PMVNF$MBJN OBNFQWD  .BOJGFTUͷ"QQMZ $MPOJOH࣮ߦ QWD QWD
  26. 26 ҰาਐΜͩ࿩

  27. 4UBUFGVM"QQͷεέʔϧΞ΢τ ‣ σʔλΛ࣋ͭεςʔτϑϧΞϓϦͷεέʔϧΞ΢τͰ͸ σʔλಉظʹ൐͏ίϐʔ͕ൃੜ͢Δέʔε͕͋Δ ‣ 7PMVNF$MPOJOH͸େྔͷσʔλΛ࣋ͭεςʔτϑϧΞϓϦΛ εέʔϧΞ΢τͤ͞Δͷʹ༗ޮ  /PEFͷ$16.FNPSZ/FUXPSLΛ࢖Θͳ͍ͨΊσʔλίϐʔʹΑΔ ੑೳӨڹΛ཈͑ΒΕΔ

     ߴ଎ 27
  28. .Z42-ͷεέʔϧΞ΢τͷྲྀΕ 28 4PVSDF 3FQMJDB 4PVSDF  ৽͍͠.Z42-ͷ1PEΛ࡞੒ /FX 4PVSDF 

    όοΫΞοϓΛऔಘ /FX #BDLVQ -PH1PTJUJPO 4PVSDF  όοΫΞοϓΛΠϯϙʔτ /FX #BDLVQ -PH1PTJUJPO 4PVSDF  3FQMJDBͱͯ͠ىಈ 3FQMJDB ࢀরܥ42- ߋ৽ܥ42- .Z42-$MJFOUT .Z42-Ϛϧνߏ੒ εέʔϧΞ΢τ࣌ͷ3FQMJDB૿ઃεςοϓ 4UPSBHF
  29. .Z42-ͷεέʔϧΞ΢τ 29 ‣ .Z42-ͷόοΫΞοϓσʔλͷड͚౉͠ʹ͸௨Γͷํ๏͕͋Γ 4PVSDF /FX #BDLVQ /'4PS0CKFDU4UPSBHF ํ๏ ํ๏

    ํ๏ 4PVSDF /FX #BDLVQ 4PVSDF /FX $MPOJOH
  30. ํ๏ͱํ๏ͷҧ͍ 30 4UPSBHF 4UPSBHF ํ๏ 4FSWFS$PQZ ํ๏ 7PMVNF$MPOJOH σʔλͷྲྀΕ

  31. 4FSWFS$PQZͰͷεέʔϦϯάྫ ‣ JOJU$POUBJOFSͰεΫϦϓτΛ࣮ߦ͠όοΫΞοϓΛίϐʔ ‣ αΠυΧʔͰεΫϦϓτΛ࣮ߦ͠όοΫΞοϓΛΠϯϙʔτˍ ϩάͷϙδγϣϯΛઃఆͨ͠ޙɺ3FQMJDBͱͯ͠.Z42-Λىಈ ‣ શ.BOJGFTU͸ҎԼΛࢀর IUUQTLVCFSOFUFTJPKBEPDTUBTLTSVOBQQMJDBUJPOSVOSFQMJDBUFETUBUFGVMBQQMJDBUJPO 31

    JOJU$POUBJOFST ʜ DPNNBOE CBTI ʜ # Get data from previous peer. ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql # Prepare the backup. xtrabackup --prepare --target-dir=/var/lib/mysql
  32. 7PMVNF$MPOJOHͷεέʔϦϯάྫ 32 BQJ7FSTJPOW LJOE1FSTJTUFOU7PMVNF$MBJN NFUBEBUB OBNFEBUBNZTRM TQFD ʜ apiVersion: apps/v1

    kind: StatefulSet metadata: name: mysql … volumeClaimTemplates: - metadata: name: data … dataSource: kind: PersistentVolumeClaim name: data-mysql-0 ‣ 4PVSDFͱͳΔ.Z42-ͷ1PE NZTRM ͷ17$͸ࣄલʹ࡞੒  ͜ͷͱ͖ͷ17$໊͸7PMVNF$MBJN5FNQMBUFTͰࣗಈੜ੒͞ΕΔ໊લ ‣ 4UBUFGVM4FUͷ7PMVNF$MBJN5FNQMBUFͰEBUB4PVSDFʹ্ه17$Λࢦఆ ‣ .Z42-ͷίϯςφͰεΫϦϓτΛ࣮ߦ͠ϩάͷϙδγϣϯΛઃఆޙɺ3FQMJDB ͱͯ͠.Z42-Λىಈ
  33. 4FSWFS$PQZWT7PMVNF$MPOJOH ‣ 4FSWFS$PQZͱ7PMVNF$MPOJOHΛ࢖ͬͨ৔߹ͷੑೳͷҧ͍͸ʁ 33

  34. ੑೳଌఆ؀ڥ ‣ ,VCFSOFUFTW XPSLFSY୆   W$16Y .FNPSZ.# ‣ /FU"QQ0/5"1W

    /FU"QQ5SJEFOU ‣ .Z42- SFTPVSDFTSFRVFTUTDQVN NFNPSZ(J  ‣ TZTCFODIʹͯ4PVSDFͷ.Z42-΁ࣄલʹϨίʔυΛొ࿥  .Z42-ͷϨίʔυ਺ ԯϨίʔυɺ໿(#  ‣ 4UBUFGVM4FUͷ3FQMJDBTΛ͔Β΁εέʔϧΞ΢τͤ͞ଌఆ 34 TZTCFODIECESJWFSNZTRMNZTRMIPTUNZTRMNZTRMNZTRMVTFSSPPUa UBCMF@TJ[FPMUQ@SFBE@POMZQSFQBSF LVCFDUMTDBMFSFQMJDBTTUBUFGVMTFUNZTRM
  35. ଌఆ݁Ռ 35 εέʔϧΞ΢τʹཁͨ͠૯࣌ؒ 3FQMJDBTˠ 1PE͋ͨΓͷੜ੒࣌ؒ ฏۉ ˞ TFD1PE TFD1PE 7PMVNF$MPOJOH

    4FSWFS$PQZ 5JNF 4FD      4FSWFS$PQZ 7PMVNF$MPOJOH ˞1PE಺ͷίϯςφ͕શͯىಈ͢Δ·Ͱͷ࣌ؒ  
  36. ଌఆ݁Ռ 36 7PMVNF $MPOJOH 4FSWFS $PQZ $16 /FUXPSL

  37. 7PMVNF$MPOJOHͷ஫ҙ఺ 37 ‣ %#ͷεέʔϧ࣌͸௥Ճɾߋ৽ͷτϥϯβΫγϣϯ͕ೖΒͳ͍Α͏ʹ 8SJUFϩοΫΛ࣮ߦ͕Ұൠత %#ͷ੩ࢭԽ  ‣ 4FSWFS$PQZ͸1PEͰ࣮ߦ͢ΔεΫϦϓτ಺ͰόοΫΞοϓ௚લʹ࣮ࢪՄೳ ‣

    7PMVNF$MPOJOHͰ͸1PEͷੜ੒લʹσʔλͷίϐʔ͕ऴΘ͍ͬͯΔͨΊɺ1PEͰ ࣮ߦ͢ΔεΫϦϓτͰ͸஗͍ ࣄલʹखಈͰ42-࣮ߦPSผ1PE͔Β࣮ߦͳͲ 4PVSDF 3FQMJDB  σʔλͷແ͍ 17$17Λ࡞੒  εΫϦϓτ࣮ߦ  σʔλίϐʔ  .Z42-ىಈ  σʔλίϐʔࡁΈͷ 17$17Λ࡞੒  εΫϦϓτ࣮ߦ  .Z42-ىಈ $MPOJOHJO4UPSBHF 4PVSDF 3FQMJDB 4FSWFS$PQZ 7PMVNF$MPOJOH %#ͷ੩ࢭԽ ΋࣮ࢪ %#ͷ੩ࢭԽ ΋࣮ࢪ
  38. 5PQPMPHZ .VMUJ";3FHJPO ؅ ཧ ऀ ޲ ͚

  39. ;POFΛҙ͍ࣝͯ͠ͳ͍഑ஔ ‣ 1PEΛ5PQPMPHZ4QSFBE$POTUSBJOUTͰ;POFΛҙࣝͨ͠഑ஔ ‣ ͔͠͠ɺ7PMVNFͷ഑ஔͷߟྀ͕࿙Ε͍ͯΔͱো֐ରࡦͱͯ͠͸ยखམͪ 39 ,VCFSOFUFT 4UPSBHF "; ";

    Ͳͷ";ͷ෺ཧϝσΟΞ ͔Β7PMVNF͕ ੜ੒͞Ε͍ͯΔͷͩΖ͏ʁ " # $ " # $
  40. $4*ͷ5PQPMPHZ"XBSF ‣ 4UPSBHF$MBTTʹͯ;POFΛࢦఆ͠17 7PMVNF ͷੜ੒ݩΛࢦఆ 40 "; "; ";༻ ";༻

    40 LJOE4UPSBHF$MBTT ʜ BMMPXFE5PQPMPHJFT NBUDI-BCFM&YQSFTTJPOT LFZGBJMVSFEPNBJOLVCFSOFUFTJP[POF WBMVFT "; LJOE4UPSBHF$MBTT ʜ BMMPXFE5PQPMPHJFT NBUDI-BCFM&YQSFTTJPOT LFZGBJMVSFEPNBJOLVCFSOFUFTJP[POF WBMVFT "; ৄࡉͳಈ࡞ݕূ͸ͪ͜ΒΛࢀর IUUQTRJJUBDPNZTBLBTIJUBJUFNTCBBDBEDF
  41. 41 ҰาਐΜͩ࿩

  42. .VMUJ";3FHJPOো֐ରԠ 42 ‣ ετϨʔδ͸σʔλΛࣦΘͳ͍͜ͱ͕ϛογϣϯͷΠϯϑϥػث ‣ ";3FHJPOো֐΁ͷରࡦํ๏͸උ͍͑ͯΔ͜ͱ͕ଟ͍ %JTBTUFS3FDPWFSZରԠ   ͲͪΒ͕࢖͑Δ͔͸ετϨʔδ੡඼࣍ୈ

    .JSSPS ಉظඇಉظ 4UPSBHF" 4UPSBHF# "; "; # $ " # $ " "; "; %BUB/PEF" #` $` " %BUB/PEF# # $`` "` %BUB/PEF$ #`` $ "`` ϛϥʔʹΑΔো֐ରࡦ σʔλϨϓϦέʔγϣϯʹΑΔ෼ࢄ഑ஔ # $ "
  43. ,VCFSOFUFTͰͷઃܭࢦ਑ 43 ‣ બ୒ࢶ͸େ͖ͭ͘  Ϣʔβ͕";3FHJPOΛҙࣝͯ͠17࡞੒  Ϣʔβʹ";3FHJPOΛҙࣝͤͣ͞ʹ17࡞੒

  44. Ϣʔβ͕";Λҙࣝͯ͠17࡞੒ 44 ‣ ";3FHJPOো֐࣌ͷσʔλফࣦ͸Ϣʔβ੹೚ ‣ $4*ͷ5PQPMPHZΛར༻ "; "; ";༻ ";༻

  45. Ϣʔβʹ";Λҙࣝͤͣ͞ʹ17࡞੒ 45 ‣ ";3FHJPOো֐࣌ͷσʔλফࣦ͸Πϯϑϥ؅ཧऀͷ੹೚ ‣ ετϨʔδͷػೳΛ׆༻ ϛϥʔPSσʔλϨϓϦέʔγϣϯ  ‣ ύϒϦοΫΫϥ΢υͷ৔߹ɺ4%4ΛηοτΞοϓ͠ߏங͢Δํ๏΋͋Γ

    "; "; "; "; %BUB/PEF" %BUB/PEF# %BUB/PEF$
  46. .POJUPSJOH ؅ ཧ ऀ ɾ  Ϣ ʔ β ޲

    ͚
  47. 1SPNFUIFVTͷϝτϦΫε؂ࢹ ‣ ετϨʔδͷ7PMVNF͕ͲͷΑ͏ʹίϯςφʹϚ΢ϯτ͞Ε͍ͯΔͷ͔Λཧղ ‣ 17ͷϝτϦΫε͸/PEFͱ֎෦ετϨʔδͷ྆ํ͔Βͷ؂ࢹ͕ϕλʔ  /PEF ετϨʔδ ωοτϫʔΫͷͲ͜ʹϘτϧωοΫ͕͋Δ͔Λ෼ੳ σΟϨΫτϦ

    σόΠε EFWTEC NOUEBUB WBSMJCLVCFMFUQPET1PEͷNFUBEBUBVJEWPMVNFTLVCFSOFUFTJPdDTJ17ͷNFUBEBUBOBNFNPVOU  EFWTEB /PEFFYQPSUFSͷϞχλϦϯάൣғ LVCFMFUͷϞχλϦϯάൣғ D"EWJTPSͷϞχλϦϯάൣғ ֎෦ετϨʔδ ಺ଂσΟεΫ $POUBJOFS <ࢀߟ৘ใετϨʔδؔ࿈ͷϝτϦΫεҰཡ> IUUQTRJJUBDPNZTBLBTIJUBJUFNTDCBCD
  48. 48 ҰาਐΜͩ࿩

  49. 17$17ࢹ఺ͷੑೳ؂ࢹ ‣ 17$ 17ͷ৘ใ͸LVCFTUBUFNFUSJDTͷϝτϦΫε  ੑೳ৘ใ͸ͳ͠ αΠζɺ਺ͳͲ  ‣ ੑೳ৘ใ͸/PEFFYQPSUFS

    D"EWJTPSͷϝτϦΫε  JPTUBU૬౰ͷ৘ใΛऔಘ 49 &MFNFOU 7BMVF kube_persistentvolumeclaim_info{…,namespace=“default”,persistentvolumeclaim=“block-pv- test-0”,storageclass=“standard”,...,volumename="pvc-9639e9ae-de8b-4f24-86f6-72273a74329b"}  ྫ LVCF@QFSTJTUFOUWPMVNFDMBJN@JOGP &MFNFOU 7BMVF node_disk_written_bytes_total{…,device=“sda”,instance=“demo-test-worker-default-efe1dfcc-bn6q7”…}  ྫ OPEF@EJTL@XSJUUFO@CZUFT@UPUBM
  50. 17$ࢹ఺Ͱͷੑೳ؂ࢹͷམͱ݀͠ ‣ (SBGBOB΍1SPNFUIFVTͰ17$໊17໊Ͱੑೳ؂ࢹΛ͍ͨ͠ ‣ ϝτϦΫε͕୯७ʹ࿈݁Ͱ͖ͳ͍  LVCFTUBUFNFUSJDTͷϝτϦΫεͷWPMVNFOBNF͸17໊ͷΈ  /PEFFYQPSUFS D"EWJTPSͷϝτϦΫεͷσόΠε໊͸04Ͱೝࣝͨ͠΋ͷ

    50 &MFNFOU 7BMVF kube_persistentvolumeclaim_info{…,namespace=“default”,persistentvolumeclaim=“block-pv- test-0”,storageclass=“standard”,...,volumename="pvc-9639e9ae-de8b-4f24-86f6-72273a74329b"}  ྫ LVCF@QFSTJTUFOUWPMVNFDMBJN@JOGP &MFNFOU 7BMVF node_disk_written_bytes_total{…,device=“sda”,instance=“demo-netapptest-worker-default-efe1dfcc-bn6q7”, …}  ྫ OPEF@EJTL@XSJUUFO@CZUFT@UPUBM
  51. ղܾҊ ‣ OPEF@pMFTZTUFN@999ͷϝτϦΫεΛؒʹڬΈղܾ  NPVOUQPJOU͔Β17໊ WPMVNFOBNF Λநग़͠࿈݁ 51 &MFNFOU 7BMVF

    kube_persistentvolumeclaim_info{…,namespace=“default”,persistentvolumeclaim=“block-pv- test-0”,storageclass=“standard”,...,volumename="pvc-9639e9ae-de8b-4f24-86f6-72273a74329b"}  ྫ LVCF@QFSTJTUFOUWPMVNFDMBJN@JOGP &MFNFOU 7BMVF node_disk_written_bytes_total{…,device=“sda”,instance=“demo-test-worker-default-efe1dfcc-bn6q7”…}  ྫ OPEF@EJTL@XSJUUFO@CZUFT@UPUBM &MFNFOU 7BMVF node_filesystem_avail_bytes{…,device=“/dev/sda”,fstype=“ext4”,instance="demo-test-worker-default- efe1dfcc-bn6q7",mountpoint="/var/lib/kubelet/pods/d1267489-a972-414a-9b38-987d3a7ea28c/volumes/ kubernetes.io~csi/pvc-9639e9ae-de8b-4f24-86f6-72273a74329b/mount"...}  ྫ OPEF@pMFTZTUFN@BWBJM@CZUFT
  52. ݁Ռ 52 sum(irate(node_disk_read_bytes_total[5m])) by (device, instance) + on(device, instance) group_left

    (persistentvolume, persistentvolumeclaim, namespace) label_replace(label_replace(node_filesystem_size_bytes{mountpoint=~"/var/lib/kubelet/pods/[^/]*/volumes/ kubernetes.io~csi/[^/]*/mount", fstype=~"ext4|xfs"}, "device", "$1", "device", "/dev/(.*)"), "persistentvolume", "$1", "mountpoint", "/var/lib/kubelet/pods/[^/]*/volumes/kubernetes.io~csi/([^/]*)/mount")*0 * on (persistentvolume) group_left (persistentvolumeclaim, namespace) label_replace(kube_persistentvolumeclaim_info, "persistentvolume", "$1", "volumename", "(.+)") ྫΫΤϦʔ
  53. 53 ΋͏ҰาਐΜͩ࿩

  54. Ϛϧνύε-7.Ͱͷམͱ݀͠ ‣ Ϛϧνύε΍-7.Ͱ͸σόΠε໊͕ஔ͖׵͑ΒΕΔͨΊ࿈݁Ͱ͖ͳ͍ ઌఔͷྫ͸γϯάϧύεͷΈ༗ޮ 54 &MFNFOU 7BMVF kube_persistentvolumeclaim_info{…,namespace=“default”,persistentvolumeclaim=“block-pv- test-0”,storageclass=“standard”,...,volumename="pvc-fdcf278e-7ba0-44da-831b-2092ffcb2589"} 

    ྫ LVCF@QFSTJTUFOUWPMVNFDMBJN@JOGP &MFNFOU 7BMVF node_disk_written_bytes_total{…,device=“dm-0”,instance=“demo-test-worker-default-efe1dfcc-bn6q7”…}  ྫ OPEF@EJTL@XSJUUFO@CZUFT@UPUBM &MFNFOU 7BMVF node_filesystem_avail_bytes{…,device=“”/dev/mapper/mpatha”,fstype=“ext4”,instance="demo-test-worker- default-efe1dfcc-bn6q7",mountpoint="/var/lib/kubelet/pods/d1267489-a972-414a-9b38-987a407bb12f/ volumes/kubernetes.io~csi/pvc-fdcf278e-7ba0-44da-831b-2092ffcb2589/mount"...}  ྫ OPEF@pMFTZTUFN@BWBJM@CZUFT 54
  55. ղܾҊ ‣ OPEF@FYQPSUFSͷ*TTVFΛௐࠪˠະղܾ  IUUQTHJUIVCDPNQSPNFUIFVTOPEF@FYQPSUFSJTTVFT ‣ /PEFFYQPSUFSͷUFYUpMFDPMMFDUPSΛ։ൃ 55 # HELP

    x_node_mountpoints_info Information about mountpoint in node # TYPE x_node_mountpoints_info gauge x_node_mountpoints_info{mountpoint="/", devname="/dev/vda1", device="vda1", fstype="ext4"} 1 x_node_mountpoints_info{mountpoint="/var/lib/kubelet", devname="/dev/vda1", device="vda1", fstype="ext4"} 1 x_node_mountpoints_info{mountpoint="/var/lib/kubelet/pods/d1267489-a972-414a-9b38-987d3a7ea28c/volumes/ kubernetes.io~csi/pvc-9639e9ae-de8b-4f24-86f6-72273a74329b/mount", devname="/dev/mapper/mpatha", device=“dm-0", fstype="ext4"} 1 ։ൃͨ͠textfile collectorͷग़ྗྫ
  56. ݁Ռ 56 sum(irate(node_disk_written_bytes_total[5m])) by (device, instance) + on (device, instance)

    group_left (volumename, persistentvolumeclaim, namespace) label_replace(node_filesystem_avail_bytes{fstype=~"ext4|xfs"}, "volumename", "$1", "mountpoint", "/var/lib/ kubelet/pods/[^/]*/volumes/kubernetes.io~csi/([^/]*)/mount") * 0 * on(mountpoint, instance) group_left(device, persistentvolumeclaim, namespace) x_node_mountpoints_info{fstype=~"ext4|xfs"} * on (volumename) group_left (persistentvolumeclaim, namespace) kube_persistentvolumeclaim_info ྫΫΤϦʔ
  57. ·ͱΊ ‣ Ϣʔβ޲͚ʹҰาਐΜͩ17ͷ࢖͍ํΛ঺հ  7PMVNF&YQBOTJPO  7PMVNF4OBQTIPU  7PMVNF$MPOJOH ‣

    ؅ཧऀ޲͚ʹҰาਐΜͩ17Λࢧ͑Δ؀ڥߏஙʹ͍ͭͯ঺հ  5PQPMPHZ  .POJUPSJOH 57