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

OpenFaaS x RancherのDeveloper Experience

OpenFaaS x RancherのDeveloper Experience

Rancher Meetup #04 in Osaka

CapsuleCloud

April 20, 2018
Tweet

More Decks by CapsuleCloud

Other Decks in Technology

Transcript

  1. 0QFO'BB4Y3BODIFSͷ%9         

      3 B O D I F S  . F F U V Q  0 T B L B   
  2. ࣗ ݾ ঺ հ   ෱ ࢁ  ݈

    Fukuyama Ken !LFOGEFW ˔ ϑϩϯτΤϯυɺόοΫΤϯυɺΠϯϑϥ ˔ "84ιϦϡʔγϣϯΞʔΩςΫτΞιγΤΠτ ˔ 6EFNZߨࢣ ˔ ʲੈքͰສਓ͕डߨʳ࣮ફʂ"OHVMBS+4ߨ࠲ ˔ 0QFO'BB4ίϯτϦϏϡʔλʔ ˔ 3BODIFS.FFUVQ0TBLBӡӦ 3BODIFS+1
  3. ձ ࣾ ঺ հ   ˔ ೥ઃཱͷιϑτ΢ΣΞ։ൃձࣾ ˔ ڌ఺ɿେࡕ

    ຊࣾ ɺ౦ژɺ޿ౡɺ෱Ԭ ˔ ૊ΈࠐΈ͔ΒεϚϗΞϓϦɺ"*·Ͱ৭ʑ΍͍ͬͯ·͢ ٕज़ϒϩάɿ4VQFS4PGUXBSF5FDIMPH I U U Q T    U F D I M P H  T V Q F S T P G U X B S F  D P  K Q  ג ࣜ ձ ࣾ ε ʔ ύ ʔ ι ϑ τ ΢ Τ Ξ 4 V Q F S 4 P G U X B S F  $ P  - U E ΦϦδφϧΞχϝɿϖʔύʔͷதʹ͋ΔΧϛΛ৯΂Δ I U U Q T    Z P V U V  C F  %  4 + [ N 1 J W  : εϚϗΞϓϦ ɿອըΧϝϥ
  4. 3 B O D I F S   

      # F U B   
  5. 3 B O D I F S   

     # F U B   Ϛ ω ʔ δ υ ͕ ͞ ͘ ͬ ͱ ؅ ཧ Ͱ ͖ Δ ͷ ΋  ΋ ͪ Ζ Μ ͏ Ε ͠ ͍ Ͱ ͢ ͕ ɾ ɾ ɾ
  6.   3 B O D I F S 

       # F U B ࣗ લ ϊ ʔ υ ΋ ͞ ͘ ͬ ͱ L  T Խ ͠ ͯ  ؅ ཧ Ͱ ͖ Δ ͷ ΋ ͏ Ε ͠ ͍ ʂ
  7.   3 B O D I F S 

       # F U B ݟ ΍ ͢ ͘ Ϋ ϥ ε λ Λ Ұ ݩ ؅ ཧ ʂ
  8.   ݟ ͑ ͯ ͖ ͨ ؾ ͕ ͠

    · ͢ ʜ ࢁ ͷ ্ ʹ ܨ ͕ Δ ΰ ϯ υ ϥ ͕ ʂ
  9.   0 Q F O ' B B 4

    ͱ ͸ ίϯςφΛ࢖ͬͨ4FSWFSMFTTͳ'SBNFXPSL ίϯςφʹೖ͍ͬͯΕ͹ԿͰ΋'VODUJPOʹͳΓಘΔ ʜ %PDLFS4XBSNͱ,VCFSOFUFTͰͷಈ࡞͕αϙʔτ͞Ε͍ͯΔ
  10. 0 Q F O ' B B 4 ͷ ࢓

    ૊ Έ   gateway / / F U D  'O" Deploy Deploy Orchestrator API 'VODUJPO4UBDL 'O# Invoke Metrics/Scale جຊߏ੒
  11. 0 Q F O ' B B 4 ͷ ࢓

    ૊ Έ   gateway 'O" Deploy Deploy Orchestrator API 'VODUJPO4UBDL 'O# Invoke Metrics/Scale 'O" 'O" Scale ΍͹͘ͳͬͨΒࣗಈతʹεέʔϧʂ / / F U D 
  12.   HTTP )FBEFST #PEZ )FBEFST #PEZ /usr/bin/node index.js SFRVFTU

    ඪ४ೖྗ TUEJO TUEPVU ඪ४ग़ྗ SFTQPOTF GQSPDFTT 'VODUJPOͷ࢓૊Έ 0 Q F O ' B B 4 ͷ ࢓ ૊ Έ
  13. % F Q M P Z  0 Q F

    O ' B B 4   ˔ Χλϩά͔Βʢ˞ʣϙνοͱΠϯετʔϧ ˞ ) F M N ͷ 4 U B C M F ʹ ͸ · ͩ ೖ ͬ ͯ ͍ ͳ ͍ ͷ Ͱ  ɹ Ϧ ϙ δ τ Ϧ ͷ ௥ Ճ ͕ ඞ ཁ Ͱ ͢
  14. ։ ൃ ϑ ϩ ʔ ʢ ͟ ͬ ͘ Γ

    ʣ   Scaffold ࣮૷ˍ Unit Test Integration Test Deploy to Local k8s Deploy to Remote k8s
  15. 4 D B G G P M E  

    ˔ GBBTDMJͷΠϯετʔϧʢ˞ʣ ˔ GBBTOFXrrMBOH։ൃ͍ͨ͠ݴޠrrQSFpYJNBHFʹ͚͍ͭͨQSFpYʼGVODUJPO໊ ˞IUUQTHJUIVCDPNPQFOGBBTGBBTDMJHFUTUBSUFEJOTUBMMUIFDMJ $ curl -sSL https://cli.openfaas.com | sudo sh faas new --lang go --prefix kenfdev sample-func
  16. G V O D U J P O ͷ C

    V J M E   go Template Container Image ˔ GVODUJPOΛϏϧυͯ͠ίϯςφΠϝʔδΛ࡞੒ faas build
  17. * O U F H S B U J P

    O  5 F T U   ˔ ͬ͘͞ͱGVODUJPOࢼ͍ͨ͠ͱ͖͸EPDLFSDPNQPTF͕ศརʂ function docker-compose curl -X POST -d ‘<౉͍ͨ͠σʔλ>’ http://127.0.0.1:<port> ςετ
  18. Container Image G V O D U J P O

    ͷ Q V T I   ˔ LTͰ࢖͑ΔΑ͏ʹίϯςφΠϝʔδΛQVTI faas push $POUBJOFS3FHJTUSZ
  19. G V O D U J P O ͷ E

    F Q M P Z   $POUBJOFS3FHJTUSZ gateway 'VODUJPO" 'VODUJPO# 'VODUJPO$ Pull Pull Deploy Deploy Orchestrator API / / F U D  faas deploy -g <gatewayͷURL>
  20.   Scaffold ࣮૷ˍ Unit Test Integration Test Deploy to

    Local k8s Deploy to Remote k8s جຊతʹ͸-PDBMLT ͱҰॹʂ
  21. ิ ଍ ɿ 4 F D S F U T

      ˔ GVODUJPOʹ4FDSFUΛઃఆͰ͖·͢͠ɺ3BODIFSͷ6*͔Β؆୯ʹ௥Ճ΋Ͱ͖·͢
  22. ิ ଍ ɿ - P D B M Ͱ ͷ

    * O H S F T T   ˔ )5514͕͍Βͳ͍৔߹͸FUDIPTUTͰϩʔΧϧΫϥελʹ޲͚Δ ※ https://ngrok.com/ ˔ )5514͕΄͍͠৔߹͸OHSPL ˞ ͳͲͷτϯωϧ͕ศར ngrok http 8080
  23. · ͱ Ί   ˔ ྑ͍ͱ͜Ζ ˔ 3BODIFS͕͋Ε͹LTͷۤߦ͸جຊతʹ͸΄ͱΜͲແ͠Ͱ࢖͏͜ͱ͕Ͱ͖Δ ˔

    -PDBMͰ΋3FNPUFͰ΋ج൫͕ಉ͡LTͳͷ͸͏Ε͍͠ ˔ 0QFO'BB4Λ࢖͏͜ͱͰ'BB4Λࣗ෼Ͱ΄ͱΜͲίϯτϩʔϧͰ͖Δ ˔ ͭΒ͍ͱ͜Ζ ˔ ͳΜ͔ͩΜͩͰ΍ͬͺΓ*OHSFTT͕ʜ
  24. 0 Q F O ' B B 4  8

    P S L T I P Q ͷ ঺ հ  
  25. 0 Q F O ' B B 4  8

    P S L T I P Q   ˔ IUUQTHJUIVCDPNLFOGEFWXPSLTIPQUSFFKBUSBOTMBUJPOTKB
  26. ͝ ਗ਼ ௌ ͋ Γ ͕ ͱ ͏ ͝ ͟

    ͍ · ͠ ͨ ʂ