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

BOSH 101

ozzozz
November 26, 2015

BOSH 101

Cloud Foundryで標準の構築手段として使われている、だけじゃないBOSHというツールの基本的な話をします。 BOSHに特有のわかりづらい概念も含め、使い方とか内部動作とかを、わかりやすく解説するよう努力した結果のスライドです。
2015/11/26の第29回PaaS勉強会 http://paas.connpass.com/event/22653/ にて発表。

ozzozz

November 26, 2015
Tweet

More Decks by ozzozz

Other Decks in Technology

Transcript

  1. $MPVE'PVOESZͱ#04) https://speakerdeck.com/ozzozz/tokyoΑΓҾ༻  Copyright©2015 NTT corp. All Rights Reserved. 

         Baremetal VM on local machine Open Source IaaS Enterprise IaaS Public IaaS   
  2. $MPVE'PVOESZͱ#04)  Copyright©2015 NTT corp. All Rights Reserved.  

      cf_nise_installer / nise_bosh BOSH bosh-lite Baremetal VM on local machine Open Source IaaS Enterprise IaaS Public IaaS all-in-one Cloud Foundry https://speakerdeck.com/ozzozz/tokyoΑΓҾ༻
  3.   *BB4Λ४උ •  "1*ΞΫηεΩʔɺ44)ݤϖΞɺηΩϡϦςΟάϧʔϓɺ 71$ 1SJWBUF/8ɺαϒωοτɺԾ૝ϧʔλ    *BB4্ʹ#04)ࣗମΛσϓϩΠ • 

    CPTIJOJUͱ͍͏ίϚϯυΛ࢖༻   #04)Λ࢖ͬͯ*BB4্ʹԿΒ͔ͷ෼ࢄγεςϜΛ σϓϩΠ "  #04)$-*ͷ४උ #  TUFNDFMMͷొ࿥ #04)Λհͯ͠*BB4΁  $  SFMFBTFͷΞοϓϩʔυ #04)CMPCTUPSFʹ֨ೲ  %  EFQMPZNFOUNBOJGFTUͷ࡞੒ͱࢦఆ &  σϓϩΠ 7.ɾϘϦϡʔϜͷ࡞੒ˠQBDLBHFͷϏϧυ ˠ֤7.΁ͷΠϯετʔϧˠ֤7.্Ͱͷϓϩηεىಈ    σϓϩΠ͞Εͨ෼ࢄγεςϜͷಈ࡞֬ೝ •  #04)͔Βಈ࡞֬ೝςετ ͋Ε͹ Λݺͼग़͢͜ͱ͕Մೳ #04)ͷ࢖͍ํͷେ·͔ͳྲྀΕ
  4. ̎ɽCPTIJOJUίϚϯυͰ#04)ΛσϓϩΠ ɹ B $1*ͷϏϧυ UFOBOU 73 pQ pQ TFDHSQ 7/8

    CPTIJOJU $1* $1*$MPVE1SPWJEFS*OUFSGBDF $ bosh-init deploy ...
  5. ̎ɽCPTIJOJUίϚϯυͰ#04)ΛσϓϩΠ ɹ C TUFNDFMM 7.Πϝʔδ ͷΞοϓϩʔυ UFOBOU 73 pQ pQ

    TFDHSQ 7/8 CPTIJOJU $1* TUFNDFMM೔ຊޠͰ͸ʮװࡉ๔ʯɻ#04)ʹ͓͚ΔTUFNDFMMʹ͍ͭͯ͸ޙ΄Ͳઆ໌ TUFN DFMM
  6. #04)֤ίϯϙʔωϯτͷ໾ׂ %# QPTUHSFTRMNZTRM $-*͔Β"1*Λհͯ͠ొ࿥͞ΕͨɺσϓϩΠޙͷ ʮ͋Δ΂͖࢟ʯΛอ࣋ /"54EJSFDUPSNPOJUPSʙBHFOUؒͷQVCTVCܕϝοηʔδϯάόε EJSFDUPS#04)"1*Λఏڙ͠ɺ7.΍σϓϩΠର৅ιϑτ΢ΣΞͷ ϥΠϑαΠΫϧͷ؅ཧ΍ΦʔέετϨʔγϣϯΛ୲͏ $1**BB4ͷछྨʹΑͬͯҟͳΔॲཧ ओʹ7.΍Ծ૝σΟεΫͳͲͷ

    ϥΠϑαΠΫϧૢ࡞ͷͨΊͷ*BB4"1*ݺͼग़͠ Λ୲͏ SFHJTUSZ7.ىಈ࣌ɾߋ৽࣌ʹBHFOUʹΑͬͯ7.ʹઃఆ͢Δ*1ΞυϨε΍ σΟεΫϚ΢ϯτϙΠϯτͳͲΛอ࣋ CMPCTUPSFιʔείʔυܗࣜͱϏϧυࡁΈܗࣜͷSFMFBTFΛอ࣋ NPOJUPSBHFOU͔Β/"54Λհͯ͠ૹΒΕΔ7.ͷঢ়ଶ΍ΠϕϯτΛ؂ࢹɺ ҟৗ࣌ʹΞϥʔτૹग़΍7.࠶࡞੒ BHFOU#04)ʹΑΓ࡞੒͞Εͨ7.ʹৗற͠ɺEJSFDUPS͔Β/"54Λհͯ͠ ༩͑ΒΕΔࢦࣔʹैͬͯ7.ࣗମͷ֤छઃఆ΍CMPCTUPSF͔Βऔಘͨ͠ ιϑτ΢ΣΞύοέʔδͷϏϧυ΍࣮ߦΛߦ͏ͱͱ΋ʹɺ /"54Λհͯ͠7.ͷঢ়ଶ΍ΠϕϯτΛૹग़ $-*#04)Ϣʔβ ෼ࢄγεςϜӡ༻ऀ ͕࢖༻͠ɺ#04)"1*΁ͷ ֤छΞΫηε΍ɺSFMFBTF࡞੒ͳͲΛ୲͏
  7.   *BB4Λ४උ •  "1*ΞΫηεΩʔɺ44)ݤϖΞɺηΩϡϦςΟάϧʔϓɺ 71$ 1SJWBUF/8ɺαϒωοτɺԾ૝ϧʔλ    *BB4্ʹ#04)ࣗମΛσϓϩΠ • 

    CPTIJOJUͱ͍͏ίϚϯυΛ࢖༻   #04)Λ࢖ͬͯ*BB4্ʹԿΒ͔ͷ෼ࢄγεςϜΛ σϓϩΠ "  #04)$-*ͷ४උ #  TUFNDFMMͷొ࿥ #04)Λհͯ͠*BB4΁  $  SFMFBTFͷΞοϓϩʔυ #04)CMPCTUPSFʹ֨ೲ  %  EFQMPZNFOUNBOJGFTUͷ࡞੒ͱࢦఆ &  σϓϩΠ 7.ɾϘϦϡʔϜͷ࡞੒ˠQBDLBHFͷϏϧυ ˠ֤7.΁ͷΠϯετʔϧˠ֤7.্Ͱͷϓϩηεىಈ    σϓϩΠ͞Εͨ෼ࢄγεςϜͷಈ࡞֬ೝ •  #04)͔Βಈ࡞֬ೝςετ ͋Ε͹ Λݺͼग़͢͜ͱ͕Մೳ #04)ͷ࢖͍ํͷେ·͔ͳྲྀΕ ଓ͖͸͔͜͜Β
  8. "ɽ#04)$-*ͷ४උ UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* #04)7. pQ EJSFDUPS

    $ gem install bosh_cli $ bosh target <BOSH VM fip> ˠʢID/PWೝূʣ
  9. #ɽTUFNDFMM 7.Πϝʔδ ͷ*BB4΁ͷొ࿥ UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN

    DFMM #04)7. pQ EJSFDUPS $1* $ bosh upload stemcell ...
  10. •  04ͷϕʔεΠϝʔδʹɺ࠷খݶͷҰൠతͳϢʔςΟ ϦςΟύοέʔδ DVSM PQFOTTI CVJMEFTTFOUJBMT  DMPVEHVFTUVUJMT ֤छϥΠϒϥϦͳͲ ɺ#04)

    BHFOUɺ͍͔ͭ͘ͷγεςϜઃఆϑΝΠϧɺΛՃ͑ ͯ࡞੒ͨ͠7.Πϝʔδͷ͜ͱ •  04ͷछྨ -JOVY͸σΟετϦ ͝ͱɺ͔ͭɺ*BB4ͷ छྨ͝ͱʹTUFNDFMMΛ༻ҙ •  7.͝ͱʹඞཁͳઃఆ /8पΓɺσΟεΫपΓɺೝ ূ৘ใͳͲ ͸શͯഉআ͠ɺ*BB4ܦ༝ NFUBEBUB TFSWJDFɺDPOpHESJWF ΍#04)BHFOUܦ༝ SFHJTUSZɺEJSFDUPSൃͷ/"54ϝοηʔδ Ͱ஫ೖ͞ ΕΔ৘ใͷΈʹج͍ͮͯ7.͕͋ΒΏΔ໾ׂΛՌͨͤ ΔΑ͏ʹઃܭ •  ηΩϡϦςΟ੬ऑੑͳͲʹΑΓஞ࣍Ξοϓσʔτ͞ ΕΔ͜ͱΛ૝ఆ͠όʔδϣϯ൪߸Λ͚ͭͯ؅ཧ #04)ʹ͓͚ΔTUFNDFMM
  11. 0QFO4UBDLͷ৔߹   "84ͷ৔߹   CPTIMJUFͷ৔߹ #04)΁ͷTUFNDFMMͷొ࿥͸جຊ͜ΕͰ0, $ bosh

    upload stemcell https://bosh.io/d/stemcells/ bosh-openstack-kvm-ubuntu-trusty-go_agent $ bosh upload stemcell https://bosh.io/d/stemcells/ bosh-aws-xen-hvm-ubuntu-trusty-go_agent ˞͍ͣΕ΋ͦͷ࣌఺ͷ࠷৽൛͕CPTIJP͔Βλʔήοτͷ#04)ʹ௚઀ొ࿥͞Ε·͢ $ bosh upload stemcell https://bosh.io/d/stemcells/ bosh-warden-boshlite-ubuntu-trusty-go_agent
  12. #04)ʹొ࿥ࡁͷTUFNDFMMΛࢀর $ bosh stemcells Acting as user 'admin' on 'microbosh'

    +-----------------------------------------+--------------- +---------+--------------------+ | Name | OS | Version | CID | +-----------------------------------------+--------------- +---------+--------------------+ | bosh-aws-xen-hvm-ubuntu-trusty-go_agent | ubuntu-trusty | 3143* | ami-f590b39b light | | bosh-aws-xen-hvm-ubuntu-trusty-go_agent | ubuntu-trusty | 3144 | ami-34416c5a light | +-----------------------------------------+--------------- +---------+--------------------+ (*) Currently in-use Stemcells total: 2
  13. $ɽSFMFBTFͷΞοϓϩʔυ UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7.

    pQ EJSFDUPS CMPCTUPSF $ bosh upload release ... Ξοϓϩʔυ͞Εͨ SFMFBTF಺ͷQBDLBHF͸ ιʔείʔυܗࣜ
  14. •  TUFNDFMMΛ༻͍ͯ࡞੒͞Εͨ͋ΒΏΔ7.্ͰͷϏϧυ ΍σϓϩΠʹ͓͍ͯ࠶ར༻ՄೳͳܗͰ·ͱΊΒΕͨɺ ओʹҎԼͷϑΝΠϧͷू߹ମ KPCTσΟϨΫτϦ഑ԼKPCUFNQMBUFΛߏ੒ •  ઃఆ߲໨ఆٛ •  ઃఆϑΝΠϧɺ͋Δ͍͸ͦͷςϯϓϨʔτ • 

    ىಈɾఀࢭεΫϦϓτɺ͋Δ͍͸ͦͷςϯϓϨʔτ •  NPOJUͷઃఆ QBDLBHFT TSD DPOpHσΟϨΫτϦ഑ԼQBDLBHFΛߏ੒ •  ϏϧυεΫϦϓτ •  ιʔείʔυɺ͋Δ͍͸ͦͷ͋Γ͔ "844ͳͲ  •  όΠφϦ෦ࡐ KBSϑΝΠϧͳͲ ɺ͋Δ͍͸ͦͷ͋Γ͔ •  ஞ࣍Ξοϓσʔτ͞ΕΔ͜ͱΛ૝ఆ͠όʔδϣϯ൪߸Λ͚ͭͯ ؅ཧ #04)ʹ͓͚ΔSFMFBTF
  15. $MPVE'PVOESZSVOUJNF DGSFMFBTF ͷ৔߹   EPDLFSCPTISFMFBTFͷ৔߹   #04)ͷ৔߹ #04)΁ͷίϛϡχςΟ൛SFMFBTFͷొ࿥

    $ bosh upload release https://bosh.io/d/github.com/ cloudfoundry/cf-release $ bosh upload stemcell https://bosh.io/d/ github.com/cf-platform-eng/docker-boshrelease ˞͍ͣΕ΋ͦͷ࣌఺ͷ࠷৽൛͕CPTIJP͔Βλʔήοτͷ#04)ʹ௚઀ొ࿥͞Ε·͢ $ bosh upload stemcell https://bosh.io/d/ github.com/cloudfoundry/bosh
  16. #04)ʹొ࿥ࡁͷSFMFBTFΛࢀর $ bosh releases Acting as user 'admin' on 'microbosh'

    +--------+----------+-------------+ | Name | Versions | Commit Hash | +--------+----------+-------------+ | cf | 218* | a80b4f5b+ | | | 225 | 24c131a5+ | | docker | 22 | 960dde57+ | +--------+----------+-------------+ (*) Currently deployed (+) Uncommitted changes Releases total: 2
  17. %ɽσϓϩΠ ɹ B EFQMPZNFOUNBOJGFTUͷ࡞੒ͱࢦఆ UFOBOU 73 pQ TFDHSQ 7/8 #04)$-*

    TUFN DFMM #04)7. pQ $ vim ?????.yml $ bosh deployment ?????.yml EFQMPZNFOU NBOJGFTU
  18. •  ओʹҎԼʹࣔ͢σϓϩΠ৚݅ઃఆ߲໨Λ·ͱΊͯهड़ͨ͠ɺ ͻͱͭͷ:".-ϑΝΠϧ OBNF෼ࢄγεςϜͷ໊শ SFMFBTFTσϓϩΠର৅ͷSFMFBTFʲෳ਺ࢦఆՄʳ OFUXPSLT7.ͷ઀ଓઌαϒωοτ΍ηΩϡϦςΟάϧʔϓʹ ؔ͢Δ৘ใ DPNQJMBUJPOSFMFBTF಺ͷQBDLBHFͷϏϧυ༻7.ͷTUFNDFMMɺ ਺ɺେ͖͞ɺ઀ଓઌɺ഑ஔઌ";ͳͲ SFTPVSDF@QPPMTσϓϩΠର৅7.ͷΧςΰϦผͷTUFNDFMMɺ

    େ͖͞ɺ઀ଓઌɺ഑ஔઌ";ͳͲ KPCT֤7.ʹؔ͠ɺ઀ଓ͞ΕΔӬଓతσΟεΫɺσϓϩΠ ͞ΕΔKPCɺ౰֘7.ಛ༗ͷઃఆύϥϝʔλɺ7.਺ QSPQFSUJFTશ7.ʹΘͨͬͯڞ௨తͳઃఆύϥϝʔλ VQEBUFσϓϩΠ࣌ͷಉ࣌ฒߦॲཧ৚݅ ฒߦՄ൱ɺ7.਺ͳͲ  #04)ʹ͓͚ΔEFQMPZNFOUNBOJGFTU
  19. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS $ bosh deploy &ɽσϓϩΠ ɹ B EFQMPZNFOUNBOJGFTUͷΞοϓϩʔυ EFQMPZNFOU NBOJGFTU
  20. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS &ɽσϓϩΠ ɹ C QBDLBHFϏϧυ༻7.ͷ࡞੒ EFQMPZNFOU NBOJGFTU $1* Ϗϧυ༻ 7. Ϗϧυ༻ 7.
  21. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS &ɽσϓϩΠ ɹ D ιʔείʔυܗࣜQBDLBHFͷϏϧυ EFQMPZNFOU NBOJGFTU Ϗϧυ༻ 7. Ϗϧυ༻ 7. BHFOU CMPCTUPSF Ϗϧυॲཧ
  22. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS &ɽσϓϩΠ ɹ E ϏϧυࡁΈܗࣜQBDLBHFͷΞοϓϩʔυ EFQMPZNFOU NBOJGFTU Ϗϧυ༻ 7. Ϗϧυ༻ 7. BHFOU CMPCTUPSF Ϗϧυॲཧ Ξοϓϩʔυ͞ ΕͨQBDLBHF͸ ϏϧυࡁΈܗࣜ
  23. UFOBOU 73 TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ EJSFDUPS

    &ɽσϓϩΠ ɹ F σϓϩΠઌ7.ɾϘϦϡʔϜͷ࡞੒ɾىಈ EFQMPZNFOU NBOJGFTU $1* 7. pQ pQ΍ϘϦϡʔϜ ͸EFQMPZNFOU NBOJGFTUͰࢦఆ ͞Εͨ7.ͷΈʹ ෇༩
  24. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS &ɽσϓϩΠ ɹ G ϏϧυࡁΈܗࣜQBDLBHFͷΠϯετʔϧ EFQMPZNFOU NBOJGFTU Ϗϧυ༻ 7. 7. BHFOU CMPCTUPSF Πϯετʔϧ
  25. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS &ɽσϓϩΠ ɹ H 7.্ͷϓϩηεͷNPOJUΛհͨ͠ىಈ EFQMPZNFOU NBOJGFTU Ϗϧυ༻ 7. 7. BHFOU NPOJU ϓϩηε ϓϩηε
  26. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS &ɽσϓϩΠ ɹ I BHFOU͔Βͷ7.ͷϓϩηεىಈ׬ྃ௨஌ EFQMPZNFOU NBOJGFTU Ϗϧυ༻ 7. 7. BHFOU NPOJU ϓϩηε ϓϩηε
  27. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS &ɽσϓϩΠ ɹ J BHFOU͔Βͷ7.ঢ়ଶͷఆظૹग़ EFQMPZNFOU NBOJGFTU Ϗϧυ༻ 7. 7. BHFOU NPOJU ϓϩηε ϓϩηε NPOJUPS
  28. #04)ͰσϓϩΠࡁͷ෼ࢄγεςϜΛࢀর $ bosh deployments Acting as user 'admin' on 'microbosh'

    +------+------------ +------------------------------------------------ +--------------+ | Name | Release(s) | Stemcell(s) | Cloud Config | +------+------------ +------------------------------------------------ +--------------+ | cf | cf/218 | bosh-openstack-kvm-ubuntu- trusty-go_agent/3100 | none | +------+------------ +------------------------------------------------ +--------------+ Deployments total: 1
  29. #04)ͰσϓϩΠࡁͷ7.ͷҰཡΛࢀর $ bosh vms Acting as user 'admin' on 'microbosh'

    Deployment `cf' Director task 184 Task 184 done +-----------+---------+---------------+----------------+ | Job/index | State | Resource Pool | IPs | +-----------+---------+---------------+----------------+ | api/0 | running | medium | 10.0.0.12 | | core/0 | running | small | 10.0.0.11 | | dea/0 | running | medium | 10.0.0.21 | | router/0 | running | small | 10.0.0.13 | | | | | 192.168.13.131 | +-----------+---------+---------------+----------------+ VMs total: 4
  30. UFOBOU 73 pQ TFDHSQ 7/8 #04)$-* TUFN DFMM #04)7. pQ

    EJSFDUPS ̐ɽσϓϩΠ͞Εͨ෼ࢄγεςϜͷಈ࡞֬ೝ EFQMPZNFOU NBOJGFTU Ϗϧυ༻ 7. 7. ϓϩηε ϓϩηε ςετ༻ 7. BHFOU $1* ಈ֬ςετ $ bosh run errand TNPLFUFTUɺ BDDFQUBODFUFTU ͳͲ
  31. •  QSPT •  %FWͱ0QTͷڥքઢ͕Θ͔Γ΍͍͢ •  %FWͷΰʔϧ͸ͪΌΜͱಈ͘SFMFBTF •  0QTͷΰʔϧ͸ͪΌΜͱಈ͘EFQMPZNFOU NBOJGFTU • 

    ෼ࢄγεςϜͷܧଓతӡ༻ʹద͍ͯ͠Δ •  ႈ౳ੑΛ୲อʢ࿮૊Έͱͯ͠൒ڧ੍తʹʣ •  Կ΋ߟ͑ͳͯ͘΋ϩʔϦϯάΞοϓσʔτ •  DPOT •  ͍ͭ·Ͱͨͬͯ΋׳Εͳ͍ɺݫֶ͍͠शۂઢ •  SFMFBTFΛͪΌΜͱ࡞Δͷ͕೉͍͠ •  EFQMPZNFOUNBOJGFTUΛͪΌΜͱॻ͘ͷ͕ ೉͍͠ #04)QSPTDPOT