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

PersistentVolumeの一歩進んだ使い方

 PersistentVolumeの一歩進んだ使い方

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

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

Yukinori Sakashita

September 09, 2020
Tweet

More Decks by Yukinori Sakashita

Other Decks in Technology

Transcript

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

    View full-size slide

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

    ‣લ৬
    ೔ཱ੡࡞ॴ
    㾎தԝݚڀॴԣ඿ݚڀॴ ओ೚ݚڀһ

    㾎ւ֎ݚڀॴ!γϦίϯόϨʔ ϥϘ௕

    αʔόϕϯμʔ ςΫχΧϧ4&

    2
    ࡔԼ޾ಙ ത࢜

    :VLJOPSJ4BLBTIJUB 1I%

    ‣ ϠϑʔגࣜձࣾθοτϥϘגࣜձࣾ
    ‣ 4/*"೔ຊࢧ෦ٕज़ҕһձ෭ҕһ௕
    ‣ 4/*"5FDIOJDBM$PVODJM"EWJTPS

    View full-size slide

  3. ओͳॻ੶8FCهࣄߨԋ
    ‣ ॻ੶,VCFSOFUFT࣮ફೖ໳ ग़൛

    ‣ 8FCهࣄ5IJOL*5
    ίϯςφΛಋೖ͠ͳ͍ͱɺͲͷΑ͏ͳະདྷ͕
    ଴͍ͬͯͨͷ͔

    ݱ৔Ͱ໾ཱͭ5JQT͕੝Γͩ͘͞Μ
    ,VCFSOFUFTͷΞϨ΍ίϨ

    ‣ ߨԋ
    ߴ஌޻Պେֶ৘ใֶ܈ಛผߨٛʮσʔλͷരൃత૿ՃΛ
    ࢧ͑ΔετϨʔδͷઌ୺ٕज़ͱࠃࡍඪ४Խʯ

    ,VCF'FTU5PLZPʮϠϑʔθοτϥϘͷ
    εςʔτϑϧΞϓϦέʔγϣϯ΁ͷ௅ઓʯ

    3

    View full-size slide

  4. "HFOEB
    ‣ ,VCFSOFUFTͰΞϓϦέʔγϣϯΛ࣮ߦ͢ΔϢʔβ޲͚
    7PMVNF&YQBOTJPO
    7PMVNF4OBQTIPU
    7PMVNF$MPOJOH
    ‣ ,VCFSOFUFTΛఏڙ͢Δ؅ཧऀ޲͚
    5PQPMPHZ .VMUJ";3FHJPO

    .POJUPSJOH
    4
    ؔ࿈ൃද,VCFSOFUFT.FFUVQ5PLZPlೖ໳ɺ,VCFSOFUFT1FSTJTUFOU7PMVNFz
    IUUQTTQFBLFSEFDLDPNZTBLBTIJUBSVNFOLVCFSOFUFTQFSTJTUFOUWPMVNF

    View full-size slide

  5. 7PMVNF&YQBOTJPO
    Ϣ
    ʔ
    β
    ޲
    ͚

    View full-size slide

  6. 7PMVNF&YQBOTJPOͱ͸
    ‣ 1FSTJTUFOU7PMVNF 17
    ͷαΠζΛ૿΍͢ػೳ ॖখ͸ෆՄ

    ‣ ετϨʔδͷ7PMVNFͷαΠζͱ'JMF4ZTUFNͷαΠζΛಉ࣌ʹ֦ு
    ‣ 4UPSBHF$MBTTʹBMMPX7PMVNF&YQBOTJPOUSVFΛઃఆ
    ‣ 1PEͷ࠶࡞੒͕ෆཁͳ0OMJOF
    ‣ 1PEͷ࠶࡞੒͕ඞཁͳ0⒐JOF
    6
    (
    (
    BQJ7FSTJPOTUPSBHFLTJPW
    LJOE4UPSBHF$MBTT
    ʜ
    BMMPX7PMVNF&YQBOTJPOUSVF
    4UPSBHF$MBTTͷઃఆྫ

    View full-size slide

  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

    View full-size slide

  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
    มߋ

    View full-size slide

  9. 9
    ҰาਐΜͩ࿩

    View full-size slide

  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

    View full-size slide

  11. 8PSLBSPVOE
    ‣ 4UBUFGVM4FUΛDBTDBEFΦϓγϣϯͰҰ࣌࡟আ
    ‣ खॱྫ
    LVCFDUMQBUDIίϚϯυͳͲͰطଘͷ17$ͷαΠζΛมߋ
    4UBUFGVM4FUͷ.BOJGFTUϑΝΠϧ಺ͷWPMVNF$MBJN5FNQMBUFTͷαΠζΛ
    खॱͱಉ͡αΠζʹมߋ
    DBTDBEFΦϓγϣϯͰ4UBUFGVM4FUΛҰ࣌࡟আ
    ࡞੒ࡁΈͷ1PE 17$ 17͸࡟আ͞Εͳ͍

    ࠶౓ɺखॱͰมߋͨ͠.BOJGFTUϑΝΠϧΛ"QQMZ
    11
    $ kubectl delete sts —cascade=false

    View full-size slide

  12. 8PSLBSPVOE ஫ҙ఺

    ‣ खॱͱͷؒ͸4UBUFGVM4FUͷϦιʔε͕ଘࡏ͠ͳ͍
    ‣ ͜ͷؒʹো֐͕ൃੜ͢ΔͱηϧϑώʔϦϯάͰͷ෮چ͠ͳ͍
    ‣ खॱͱ͸ؒ൅ೖΕͣʹ࣮ߦ͢Δͷ͕͓קΊ
    12

    View full-size slide

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

    View full-size slide

  14. 17ͷ҆શͳαΠζ
    ‣ 7PMVNF&YQBOTJPO͸ɺ࠷ऴखஈ͙Β͍ͷҙࣝͰαΠζΛࣄલʹઃܭ
    ‣ ετϨʔδͰ5IJO1SPWJTJPOJOH͕αϙʔτͷ৔߹ɺαΠζͷେ͖ͳ17
    Λ༧Ί࡞੒
    5IJO1SPWJTJPOJOH͸࣮ࡍͷॻ͖ࠐ·ΕͨྖҬͷΈ
    ෺ཧϝσΟΞ 44%ɺ)%%
    Λফඅ
    ‣ 4UBUFGVM4FUͰͷ7PMVNF&YQBOTJPO͸8PSLBSPVOE͕͓קΊ

    8PSLBSPVOEͷ࣮ࢪத͸(JU0QT่͕Εͯ͠·͏͕ɺҎ߱͸(JU0QT͕ܧଓ
    8PSLBSPVOE͸4UBUFGVM4FUͰεέʔϧΞ΢τલʹ17$ͷ.BOJGFTUΛ࡞੒
    ͢Δඞཁ͋Γ ๨ΕΔͱ17ͷσʔλᷓΕͷࣄނʹͭͳ͕ΔϦεΫ͋Γ

    14

    View full-size slide

  15. 7PMVNF4OBQTIPU
    Ϣ
    ʔ
    β
    ޲
    ͚

    View full-size slide

  16. 4OBQTIPUͱ͸ ετϨʔδͷ஌ࣝ

    ‣ 4OBQTIPUΛ࡞੒ͨ࣌͠ࠁͷσʔλΛอଘ͢Δػೳ
    16
    "
    5JNF
    # #
    "`
    $ $

    "Λ"`ʹ
    ॻ͖׵͑
    4OBQTIPU
    7PMVNF



    "
    "
    #
    $




    "
    #
    $
    #`




    "`
    4OBQTIPU࡞੒
    4PVSDF
    4OBQTIPU࡞੒
    #Λ#`ʹ
    ॻ͖׵͑
    ࠩ෼σʔλͷ
    อଘྖҬ
    $P8 $PQZPO8SJUF
    ʹ
    ΑΔࠩ෼όοΫΞοϓ
    "`

    View full-size slide

  17. ,VCFSOFUFTͷ7PMVNF4OBQTIPU
    ‣ 7PMVNF4OBQTIPU͸ͭͷϦιʔεͰදݱ
    7PMVNF4OBQTIPU4OBQTIPUͷཁٻ࢓༷
    7PMVNF4OBQTIPU$POUFOU4OBQTIPUͷίϯςϯπ ࠩ෼σʔλͷू߹

    7PMVNF4OBQTIPU$MBTT4OBQTIPU༻ͷ4UPSBHF$MBTT ͷΑ͏ͳ΋ͷ

    ‣ 7PMVNF4OBQTIPUϦιʔεΛ࡞੒͢Δ͜ͱͰετϨʔδ಺Ͱ4OBQTIPU͕࣮ߦ
    ‣ 7PMVNF4OBQTIPU$POUFOUϦιʔε͸ࣗಈੜ੒
    17

    View full-size slide

  18. 7PMVNF4OBQTIPU
    18
    BQJ7FSTJPOTOBQTIPUTUPSBHFLTJPWCFUB
    LJOE7PMVNF4OBQTIPU
    NFUBEBUB
    OBNFTOBQTIPUQWD
    TQFD
    WPMVNF4OBQTIPU$MBTT/BNFDTJTOBQTIPU
    TPVSDF
    QFSTJTUFOU7PMVNF$MBJN/BNFUFTUQWD

    UFTUQWD TOBQTIPUQWD
    ࢦఆ
    .BOJGFTUͷ"QQMZ
    4OBQTIPU࣮ߦ

    View full-size slide

  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࣮ߦ

    View full-size slide

  20. 20
    ҰาਐΜͩ࿩

    View full-size slide

  21. ݩͷ17ͷඞཁੑ
    ‣ ετϨʔδͷ4OBQTIPU͸ࠩ෼σʔλͷΈอଘ
    ‣ 4OBQTIPUதͷࠩ෼σʔλ΁ͷΞΫηε͸ݪଇ3FBE0OMZ
    ‣ ݩͷ7PMVNFΛ࡟আ͢Δͷ͸/(
    ‣ ,VCFSOFUFTͷ7PMVNF4OBQTIPUʹ͓͍ͯ΋ݩͷ17$17͸࡟আͯ͠͸/(
    ‣ ໰୊
    3FTUPSFͨ͠ޙͰ͋Ε͹ɺ࢖Θͳ͘ͳͬͨݩͷ17$17͸࡟আͯ͠΋ྑ͍͔ʁ
    21

    View full-size slide

  22. ݩͷ17ͷඞཁੑ ଓ͖

    ‣ ౴͑
    ར༻͢ΔετϨʔδʹΑΓ·͢
    22
    #
    "`
    $
    "
    3FBE8SJUF 3FBE8SJUF
    #
    "`
    $
    "
    ݩͷ7PMVNF 4OBQTIPU
    3FBE8SJUF 3FBE
    #
    "`
    $
    "
    3FBE8SJUF 3FBE8SJUF
    #
    $
    4OBQTIPUத
    8SJUBCMF4OBQTIPUΛ࢖༻
    $MPOFͰ৽ن7PMΛ࡞੒
    ݩͷ17͸
    ࡟আ/(
    ݩͷ17͸
    ࡟আ0,
    3FTUPSF
    "
    3FBE

    View full-size slide

  23. 7PMVNF$MPOJOH
    Ϣ
    ʔ
    β
    ޲
    ͚

    View full-size slide

  24. $MPOFͱ͸ ετϨʔδͷ஌ࣝ

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

    View full-size slide

  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

    View full-size slide

  26. 26
    ҰาਐΜͩ࿩

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  29. .Z42-ͷεέʔϧΞ΢τ
    29
    ‣ .Z42-ͷόοΫΞοϓσʔλͷड͚౉͠ʹ͸௨Γͷํ๏͕͋Γ
    4PVSDF /FX
    #BDLVQ
    /'4PS0CKFDU4UPSBHF
    ํ๏ ํ๏ ํ๏
    4PVSDF /FX
    #BDLVQ
    4PVSDF /FX
    $MPOJOH

    View full-size slide

  30. ํ๏ͱํ๏ͷҧ͍
    30
    4UPSBHF 4UPSBHF
    ํ๏ 4FSWFS$PQZ
    ํ๏ 7PMVNF$MPOJOH

    σʔλͷྲྀΕ

    View full-size slide

  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

    View full-size slide

  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-Λىಈ

    View full-size slide

  33. 4FSWFS$PQZWT7PMVNF$MPOJOH
    ‣ 4FSWFS$PQZͱ7PMVNF$MPOJOHΛ࢖ͬͨ৔߹ͷੑೳͷҧ͍͸ʁ
    33

    View full-size slide

  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

    View full-size slide

  35. ଌఆ݁Ռ
    35
    εέʔϧΞ΢τʹཁͨ͠૯࣌ؒ 3FQMJDBTˠ
    1PE͋ͨΓͷੜ੒࣌ؒ ฏۉ
    ˞
    TFD1PE
    TFD1PE
    7PMVNF$MPOJOH
    4FSWFS$PQZ
    5JNF 4FD


    4FSWFS$PQZ
    7PMVNF$MPOJOH
    ˞1PE಺ͷίϯςφ͕શͯىಈ͢Δ·Ͱͷ࣌ؒ


    View full-size slide

  36. ଌఆ݁Ռ
    36
    7PMVNF
    $MPOJOH
    4FSWFS
    $PQZ
    $16 /FUXPSL

    View full-size slide

  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
    %#ͷ੩ࢭԽ
    ΋࣮ࢪ
    %#ͷ੩ࢭԽ
    ΋࣮ࢪ

    View full-size slide

  38. 5PQPMPHZ .VMUJ";3FHJPO

    ؅


    ޲
    ͚

    View full-size slide

  39. ;POFΛҙ͍ࣝͯ͠ͳ͍഑ஔ
    ‣ 1PEΛ5PQPMPHZ4QSFBE$POTUSBJOUTͰ;POFΛҙࣝͨ͠഑ஔ
    ‣ ͔͠͠ɺ7PMVNFͷ഑ஔͷߟྀ͕࿙Ε͍ͯΔͱো֐ରࡦͱͯ͠͸ยखམͪ
    39
    ,VCFSOFUFT
    4UPSBHF
    "; ";
    Ͳͷ";ͷ෺ཧϝσΟΞ
    ͔Β7PMVNF͕
    ੜ੒͞Ε͍ͯΔͷͩΖ͏ʁ
    "
    #
    $
    "
    # $

    View full-size slide

  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

    View full-size slide

  41. 41
    ҰาਐΜͩ࿩

    View full-size slide

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

    ͲͪΒ͕࢖͑Δ͔͸ετϨʔδ੡඼࣍ୈ
    .JSSPS
    ಉظඇಉظ
    4UPSBHF" 4UPSBHF#
    "; ";
    #
    $
    "
    #
    $
    "
    "; ";
    %BUB/PEF"
    #`
    $`
    "
    %BUB/PEF#
    #
    $``
    "`
    %BUB/PEF$
    #``
    $
    "``
    ϛϥʔʹΑΔো֐ରࡦ σʔλϨϓϦέʔγϣϯʹΑΔ෼ࢄ഑ஔ
    #
    $
    "

    View full-size slide

  43. ,VCFSOFUFTͰͷઃܭࢦ਑
    43
    ‣ બ୒ࢶ͸େ͖ͭ͘
    Ϣʔβ͕";3FHJPOΛҙࣝͯ͠17࡞੒
    Ϣʔβʹ";3FHJPOΛҙࣝͤͣ͞ʹ17࡞੒

    View full-size slide

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

    View full-size slide

  45. Ϣʔβʹ";Λҙࣝͤͣ͞ʹ17࡞੒
    45
    ‣ ";3FHJPOো֐࣌ͷσʔλফࣦ͸Πϯϑϥ؅ཧऀͷ੹೚
    ‣ ετϨʔδͷػೳΛ׆༻ ϛϥʔPSσʔλϨϓϦέʔγϣϯ

    ‣ ύϒϦοΫΫϥ΢υͷ৔߹ɺ4%4ΛηοτΞοϓ͠ߏங͢Δํ๏΋͋Γ
    "; ";
    "; ";
    %BUB/PEF"
    %BUB/PEF#
    %BUB/PEF$

    View full-size slide

  46. .POJUPSJOH
    ؅


    ɾ

    Ϣ
    ʔ
    β
    ޲
    ͚

    View full-size slide

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

    EFWTEB
    /PEFFYQPSUFSͷϞχλϦϯάൣғ
    LVCFMFUͷϞχλϦϯάൣғ
    D"EWJTPSͷϞχλϦϯάൣғ
    ֎෦ετϨʔδ
    ಺ଂσΟεΫ
    $POUBJOFS
    <ࢀߟ৘ใετϨʔδؔ࿈ͷϝτϦΫεҰཡ>
    IUUQTRJJUBDPNZTBLBTIJUBJUFNTDCBCD

    View full-size slide

  48. 48
    ҰาਐΜͩ࿩

    View full-size slide

  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

    View full-size slide

  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

    View full-size slide

  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

    View full-size slide

  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", "(.+)")
    ྫΫΤϦʔ

    View full-size slide

  53. 53
    ΋͏ҰาਐΜͩ࿩

    View full-size slide

  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

    View full-size slide

  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ͷग़ྗྫ

    View full-size slide

  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
    ྫΫΤϦʔ

    View full-size slide

  57. ·ͱΊ
    ‣ Ϣʔβ޲͚ʹҰาਐΜͩ17ͷ࢖͍ํΛ঺հ
    7PMVNF&YQBOTJPO
    7PMVNF4OBQTIPU
    7PMVNF$MPOJOH
    ‣ ؅ཧऀ޲͚ʹҰาਐΜͩ17Λࢧ͑Δ؀ڥߏஙʹ͍ͭͯ঺հ
    5PQPMPHZ
    .POJUPSJOH
    57

    View full-size slide