Knative Serving 入門 / kubernetes meetup 13

C84357a21083c81c5ccd5550422abc8d?s=47 Ryo Takaishi
September 28, 2018

Knative Serving 入門 / kubernetes meetup 13

C84357a21083c81c5ccd5550422abc8d?s=128

Ryo Takaishi

September 28, 2018
Tweet

Transcript

  1. ∁ੴྒ / GMO Pepabo, Inc. 2018-09-28 Kubernetes Meetup #13 ,OBUJWF4FSWJOHೖ໳

  2. ∁ੴ ྒ / @r_takaishi TAKAISHI Ryo https://repl.info/ Belgian beer Ruby,

    Go Kubernetes, OpenStack
  3. ∁ੴ ྒ / @r_takaishi TAKAISHI Ryo •ιϑτ΢ΣΞΤϯδχΞ @ GMOϖύϘ •΢ΣϒαʔϏεͷج൫ߏஙɾӡ༻

    •࠷ۙ͸FluentdͷϓϥάΠϯΛॻ͍͍ͯ·͢ •OpenStackΛ࢖ͬͨϓϥΠϕʔτΫϥ΢υӡ༻ •Kubernetes on OpenStack؀ڥͷߏங •஥ؒืूதʂ
  4. ,OBUJWF

  5. ,OBUJWF4FSWJOH

  6. • Knative ServingͷΞʔΩςΫνϟ΍ࢥ૝ʹ͍ͭͯ • ಛ௃తͳػೳͷ1ͭͰ͋Δθϩɾεέʔϧʹ͍ͭͯ • ୭Λର৅ͱͨ͠ϓϩμΫτͳͷ͔ʁզʑ͸Ͳ͏઀͢Ε͹͍͍ͷ͔ʁ !6 ࠓ೔࿩͢͜ͱ

  7. • Knative Eventing • Knative Building • ಺෦࣮૷ !7 ࠓ೔࿩͞ͳ͍͜ͱ

  8. ݁࿦

  9. • Knative Servingͷΰʔϧ͸ɺPaaS/FaaSͷ֓೦ΛؚΉαʔόʔϨεϫʔΫϩʔ υͷͨΊͷAPIͱπʔϧΛఏڙ͢Δ͜ͱ • ൓ԠతʹΞϓϦέʔγϣϯΛىಈɾεέʔϧ͠ɺར༻͕ͳ͚Ε͹ఀࢭ͢ΔΞʔ ΩςΫνϟͰ͋Δ • 2018೥9݄࣌఺Ͱ͸ΞʔΩςΫνϟͱAPIͷΈఏڙ͞Ε͍ͯΔঢ়گɻʢ·ͩެ ࣜͰ͸ͳ͍͕ʣCLIπʔϧ͕ొ৔࢝͠Ί͍ͯΔ

    • IaaSɺCaaSɺPaaSͱ͍ͬͨج൫ٕज़ͷԆ௕ઢ্ʹ͋ΔϓϩμΫτͰɺKnative Ͱ͸ͳͯ͘΋͍͍͕ߟ͑ํ͸஌͓ͬͯ͘ͱΑ͍ͱࢥ͏ !9 ݁࿦ɿ,OBUJWF4FSWJOHͱ͸Կͳͷ͔
  10. ,OBUJWF͕໨ࢦ͢ΰʔϧ

  11. • Google Cloud Next 2018Ͱൃද͞Εͨʢ2018೥7݄຤ʣ • αʔόʔϨεΛఏڙ͢ΔϓϥοτϑΥʔϜ • Kubernetes্ʹߏங !11

    ,OBUJWFʁ
  12. • BuildɿίϯςφΠϝʔδΛϏϧυ͢Δ • EventingɿΠϕϯτͷσϦόϦʔΛ؅ཧ͢Δ • ServingɿϦΫΤετۦಈͰίϯςφΛىಈɾεέʔϧ͢Δ !12 ,OBUJWF

  13. None
  14. • Knative Servingͷΰʔϧ͸ɺαʔόʔϨεϫʔΫϩʔυͷͨΊͷ APIͱπʔϧΛఏڙ͢Δ͜ͱ • ެࣜͷCLIπʔϧɺGUI͸·ͩͳ͍ͬΆ͍ • cppforlife/knctlɿίϛϡχςΟϦιʔεͰ։ൃ͞Ε͍ͯΔ໛༷ • CLI͚ͩͰσϓϩΠ΍τϥϑΟοΫ෼ׂ͕࣮ݱՄೳʹͳΔʁ

    !14 ,OBUJWF4FSWJOH͕໨ࢦ͢ΰʔϧ https://github.com/knative/serving/blob/v0.1.1/docs/spec/motivation.md
  15. αʔόʔϨεʁ

  16. !16 • εςʔτϨεͰ͋Δ͜ͱ • ϓϩηεͷεέʔϧΞ΢τ͕ద༻ՄೳͰ͋Δ͜ͱ • ओʹΞϓϦέʔγϣϯϨϕϧʢL7ɺྫ͑͹HTTPʣͷϦΫΤεττ ϥϑΟοΫʹΑͬͯۦಈ͢Δ͜ͱ αʔόʔϨεɾϫʔΫϩʔυ

  17. • ΋ͪΖΜବ໨Ͱ͸ͳ͍ • Kubernetes͸αʔόʔϨεϫʔΫϩʔυΛѻ͑ΔϦιʔεΛఏڙ͠ ͍ͯΔʢDeploymentɺServiceͳͲʣ • ͔͠͠ɺ͜ΕΒͷϦιʔε͸ΞϓϦέʔγϣϯ։ൃऀ͔Βݟͨͱ͖ɺ े෼ʹγϯϓϧͱ͸ݴ͑ͳ͍ !17 ,VCFSOFUFTͰ͸ବ໨ͳͷ͔

  18. • Kubernets্ͷΞϓϦέʔγϣϯϓϥοτϑΥʔϜʹ͸ڞ௨఺͕ଟ ͍ • Knative͸ڞ௨఺Λඪ४ԽɾΧελϜϦιʔεԽ͢Δ • ͜ΕʹΑΓΞϓϦέʔγϣϯ։ൃऀ͔ΒݟͨΠϯϑϥΛந৅Խ͢Δ !18 ,VCFSOFUFTͰ͸ବ໨ͳͷ͔

  19. ߏ੒ཁૉ

  20. • CRD(Custom Resource Definitions)Ͱఆٛ • Revision • Configuration • Route

    • Service !20 ,OBUJWF4FSWJOH͕ఏڙ͢ΔϦιʔε Route Configuration Revision Service Revision Revision NBOBHFT SPVUFUSB⒏DUP SFDPSEIJTUPSZPG
  21. • Revision • ίʔυͱઃఆͷεφοϓγϣοτ • ConfigurationʹΑͬͯ࡞੒ !21 ,OBUJWF4FSWJOH͕ఏڙ͢ΔϦιʔε Route Configuration

    Revision Service Revision Revision NBOBHFT SPVUFUSB⒏DUP SFDPSEIJTUPSZPG
  22. • Configuration • ࠷৽ͷRevisionʹ͍ͭͯͷهड़ • Configurationͷߋ৽ʹΑΓɺ৽͍͠ Revision͕࡞ΒΕΔ !22 ,OBUJWF4FSWJOH͕ఏڙ͢ΔϦιʔε Route

    Configuration Revision Service Revision Revision NBOBHFT SPVUFUSB⒏DUP SFDPSEIJTUPSZPG
  23. • Route • αʔϏε޲͚ΤϯυϙΠϯτΛఏڙ • ΤϯυϙΠϯτͷޙΖʹ͸1ͭҎ্ͷ Revision͕ଘࡏ • ύʔηϯςʔδϕʔεͰτϥϑΟοΫ Λ෼ׂ

    !23 ,OBUJWF4FSWJOH͕ఏڙ͢ΔϦιʔε Route Configuration Revision Service Revision Revision NBOBHFT SPVUFUSB⒏DUP SFDPSEIJTUPSZPG
  24. • Service • RouteͱConfigurationΛ࡞੒͢Δ • جຊతʹServiceΛ࢖͏ͱָ • KubernetesͷDeploymentͱ ReplicaSetͷؔ܎ !24

    ,OBUJWF4FSWJOH͕ఏڙ͢ΔϦιʔε Route Configuration Revision Service Revision Revision NBOBHFT SPVUFUSB⒏DUP SFDPSEIJTUPSZPG
  25. • Blue Green DeploymentͷσϞ • ৽͍͠όʔδϣϯͷΞϓϦέʔγϣϯʹঃʑʹτϥϑΟοΫΛྲྀ͠ ͍ͯ͘ !25 %FNP

  26. εέʔϦϯά

  27. • Knative Serving͸ϦΫΤετΛτϦΨʔͱͯ͠ΞϓϦέʔγϣϯΛ ىಈɾεέʔϧΞ΢τ͢Δ • Pod1୆͋ͨΓͷෛՙ͕ৗʹҰఆʹͳΔΑ͏ʹPodͷ୆਺Λ૿ݮ͢Δ • Horizontal Auto Scaling

    • ϦΫΤετ͕Ұఆظؒͳ͍৔߹ɺPodͷ୆਺Λ0ʹͯ͠Ϧιʔεޮ ཰Λ্͛Δ͜ͱ΋Ͱ͖Δ !27 ,OBUJWFͷεέʔϦϯάͱ͸Կ͔
  28. !28 Φʔτεέʔϧͷ࢓૊Έ Istio Route Route Revision Pods Deployment Autoscaler Activator

    inactive route active route watch first activate metrics resize create/delete
  29. !29 ༻ޠ Knative Serving Revision ϢʔβʔͷίʔυͱઃఆͷεφοϓγϣοτΛѻ͏ΧελϜϦιʔε Knative Serving Route RevisionͷIstioͷΠϯάϨεϧʔϧΛ௨ͯ͠ΫϥΠΞϯτʹެ։͢ΔΧελϜϦιʔε

    Kubernetes Deployment Podͱͯ͠ಈ͘ίϯςφͷϥΠϑαΠΫϧΛ؅ཧ͢ΔKubernetesͷϦιʔε Knative Serving Autoscaler Ϣʔβʔͷίʔυ͕ಈ͘PodͷෛՙΛ؂ࢹ͢ΔͨΊͷDeploymentɻ PodͷෛՙΛҰఆʹอͭΑ͏ʹϢʔβʔίʔυ༻ͷDeploymentͷαΠζΛ૿ݮ͢Δ Knative Serving Activator KnativeͰ͸ϦΫΤετ͕ಧ͍ͨ࣌ɺͦΕΛड͚औΔPod͕ͳ͍Մೳੑ͕͋Δɻ ͦ͏͍͏࣌ʹϦΫΤετΛड͚औΔDeploymentɻPodΛىಈ͠ɺϦΫΤετΛϑΥϫʔυ͢Δ Concurrency ॠؒॠؒͰॲཧ͍ͯ͠ΔϦΫΤετͷ਺
  30. !30 1PE͕ىಈ͍ͯ͠ͳ͍৔߹ Istio Route Route Revision Pods Deployment Autoscaler Activator

    inactive route active route watch first activate metrics PodͷىಈΛ؂ࢹ PodΛىಈ͢Δ create/delete resize
  31. !31 1PE͕ىಈ͍ͯ͠Δ৔߹ Istio Route Route Revision Pods Deployment Autoscaler Activator

    inactive route active route watch first activate metrics Pod͕ىಈ͍ͯ͠Δ৔߹ɺ ϦΫΤετ͸Pod΁ Autoscaler͸Podͷ ϝτϦοΫΛ؂ࢹ create/delete resize
  32. !32 1PEͷෛՙ͕ߴ͗͢Δ௿͗͢Δ৔߹ Istio Route Route Revision Pods Deployment Autoscaler Activator

    inactive route active route watch first activate create/delete metrics resize
  33. • Fast Brain • Pod1୆ຖͷಉ࣌ཁٻͷਫ४Λҡ࣋͢Δ • ྫɿPod1୆͕1ඵ͋ͨΓ100ϦΫΤετΛॲཧ͢ΔΑ͏୆਺Λ૿ݮ • Slow Brain

    • Fast BrainͰ࢖͏ਫ४ΛCPU΍ϝϞϦɺϨΠςϯγͳͲͷ౷ܭʹج͍ͮͯ ఏҊ͢Δ • v0.1.1Ͱ͸ະ࣮૷ʢϋʔυίʔυ͞Ε͍ͯΔʣ !33 "VUPTDBMFS͸ͭͷ೴Λ࣋ͭ
  34. ཧղΛਂΊΔ

  35. Ϧιʔεͱ͔εέʔϧͷ࢓૊Έͱ͔ ݟͤΒΕ͚ͨͲɺ݁ہͲ͏͍͏΋ͷ ͳͷ

  36. • ॏཁͳͷ͸ϦΫΤετͰۦಈ͢Δɺͱ͍͏఺ • ίϯςφͰந৅Խ͢Ε͹ͲͪΒ΋ಉ͡Α͏ʹۦಈͰ͖Δ • ΞϓϦέʔγϣϯͷ৔߹͸ىಈޙϓϩηε͕ಈ͖ଓ͚Δ • ΞΫηε͕ͳ͚Ε͹ϓϩηεΛऴྃ • ϑΝϯΫγϣϯ͸ϦΫΤετͰۦಈɺ࣮ߦޙऴྃ

    • => FaaS༝དྷͷΠϕϯτۦಈ΋OK !36 ,OBUJWF͸ΞϓϦέʔγϣϯͱϑΝϯΫγϣϯΛ۠ผ͠ͳ͍
  37. ϦΫΤετͰϓϩηε͕ىಈ ΞΠυϧঢ়ଶͳΒϓϩηεΛఀࢭ

  38. ͋Εʜʁ͜ͷ࢓૊Έɺ Ͳ͔͜Ͱݟͨ͜ͱ͕͋ΔΑ͏ͳʜʁ

  39. ḪΔ͜ͱ೥લʜ

  40. ΋͏গ͠ḪΖ͏

  41. ḪΔ͜ͱ਺೥લʜ

  42. 'BTU$(*

  43. • CGIɿϦΫΤετຖʹϓϩηεੜ੒ɾഁغΛ࣮ߦ • FastCGIɿϦΫΤετຖʹϓϩηεΛੜ੒ɺ࢖͍ճ͢͜ͱͰੑೳUpɻΞΠυ ϧঢ়ଶ͕ଓ͍ͨ৔߹ϓϩηεΛഁغ • KnativeɿॳճϦΫΤετ࣌ʹPodΛੜ੒ɺFunctionͰͳ͚Ε͹࢖͍ճ͢ɻϦ ΫΤετ͕Ұఆظؒಧ͔ͳ͚Ε͹PodΛऴྃ !43 'BTU$(*

  44. ࣅͨ࢓૊Έͩʂ

  45. • ϓϩΞΫςΟϒੑ • ΞϓϦέʔγϣϯ͕͋Β͔͡Ίىಈ͓ͯ͠Γɺঢ়ଶͷଈ࣌มߋ͸Ͱ͖ͳ͍͕ߴ଎ͳॲཧ͕ Մೳͳੑ࣭ • ىಈͬ͠ͺͳ͠ͳͷͰϦιʔεޮ཰͸ѱ͍ • ࣄલʹαʔόΛىಈͯ͠ΞΫηεʹඋ͑ΔΞϓϩʔν •

    ϦΞΫςΟϒੑ • ϦΫΤετʹԠͯ͡ΞϓϦέʔγϣϯΛىಈ͢Δੑ࣭ͷ͜ͱ • ىಈͱఀࢭͷίετ͕͋Δ͕ɺϦιʔεޮ཰͸Α͍ • ΞϓϦέʔγϣϯ͸ݱ࣮తͳ࣌ؒͰىಈͯ͘͠Δ͜ͱ͕લఏ !45 ϓϩΞΫςΟϒੑͱϦΞΫςΟϒੑ
  46. • ϓϩΞΫςΟϒੑ • ΞϓϦέʔγϣϯ͕͋Β͔͡Ίىಈ͓ͯ͠Γɺঢ়ଶͷଈ࣌มߋ͸Ͱ͖ͳ͍͕ߴ଎ͳॲཧ͕ Մೳͳੑ࣭ • ىಈͬ͠ͺͳ͠ͳͷͰϦιʔεޮ཰͸ѱ͍ • ࣄલʹαʔόΛىಈͯ͠ΞΫηεʹඋ͑ΔΞϓϩʔν •

    ϦΞΫςΟϒੑ • ϦΫΤετʹԠͯ͡ΞϓϦέʔγϣϯΛىಈ͢Δੑ࣭ͷ͜ͱ • ΞϓϦέʔγϣϯ͸ݱ࣮తͳ࣌ؒͰىಈͯ͘͠Δ͜ͱ͕લఏ • ىಈͱఀࢭͷίετ͕͋Δ͕ɺϦιʔεޮ཰͸Α͍ !46 ϓϩΞΫςΟϒੑͱϦΞΫςΟϒੑ •CGI΍FastCGIɺFaaS͕֘౰ •FastCGI͸Ϧιʔεޮ཰ͱੑೳͷཱ྆ͷͨΊҰఆظؒىಈ •FaaS΋ϦΞΫςΟϒੑΛ࣋ͭϓϥοτϑΥʔϜͷҰͭ
  47. • @matsumotoryʹΑΓఏҊ(2017) !47 'BTU$POUBJOFSͱ͍͏ΞʔΩςΫνϟ

  48. • Πϯελϯε௥Ճॲཧ͕௿଎Ͱ͋Δ • ֎෦͔Βͷఆظతͳ؂ࢹΛ༻͍ͨݕ஌ͱεέʔϧͩͱཻ౓͕ૈ͍ • VMͷ৔߹ɺىಈ͕ಥൃΞΫηεʹؒʹ߹Θͳ͍έʔε͕͋Δ • Ϧιʔεͷར༻ޮ཰ͷ௿͞ • جຊతʹΠϯελϯε͕ىಈɺϦιʔεΛ઎༗͠ଓ͚Δ

    !48 'BTU$POUBJOFS͸ͲͷΑ͏ͳ໰୊ʹର͢ΔఏҊ͔
  49. None
  50. • FastContainer͸ϗεςΟϯάαʔϏεͱ͍͏ྲྀΕͷ্ʹੜ·Εͨߟ ͑ํ • Knative͸Kubernetes΍Cloud Nativeͱ͍͏ྲྀΕͷ্ʹੜ·Εͨϓ ϩμΫτ • গ͠ҧ͏จ຺͔Βɺಉ͡Α͏ͳ΋ͷ͕ొ৔͖͍ͯͯ͠Δ •

    ϦΞΫςΟϒͳϓϥοτϑΥʔϜ͕ࠓޙ૿͑Δʁ !50 ,OBUJWFͱࣅͨΞʔΩςΫνϟ͸ଞʹ΋ଘࡏ͢Δ
  51. • Knative͸൓ԠతʢϦΞΫςΟϒʣʹΞϓϦέʔγϣϯ΍ϑΝϯΫγϣϯΛ ىಈ͠ɺෛՙʹԠͯࣗ͡ಈ૿ݮ͢Δ • ΞϓϦέʔγϣϯɺϑΝϯΫγϣϯΛ໰ΘͣϦΞΫςΟϒͳ࢓૊Έ͕ࠓޙ૿ ͑ͯ͘ΔͷͰ͸ͳ͍͔ʢAmazon Aurora Serverlessʣ • CGI࣌୅͸HTTPϦΫΤετ͚͕ͩͩͬͨɺݱ୅͸༷ʑͳΠϕϯτʹରͯ͠൓

    ԠతʹॲཧΛߦ͍ͬͯ͘ʢEventingͷൣғͳͷͰׂѪʣ !51 ΞʔΩςΫνϟ·ͱΊ
  52. ϖϧιφ

  53. • ੡඼΍αʔϏεΛσβΠϯ͢Δࡍɺλʔήοτͱͯ͠૝ఆ͢ΔՍۭ ͷϢʔβʔ૾ͷ͜ͱ • KnativeͷλʔήοτͱͳΔϢʔβʔ͸Ͳ͏͍͏ਓ͔ʁͲ͏͍͏໨ త΍ϞνϕʔγϣϯΛ͍࣋ͬͯΔͷ͔ • ͜͏͍͏͜ͱΛܾΊ͓ͯ͘͜ͱͰɺKnativeͷϓϩμΫτͱͯ͠ͷํ ޲ੑ͕ϒϨͳ͍Α͏ʹ͢Δ !53

    ϖϧιφʁ
  54. • ར༻ऀͱͯ͠͸DeveloperͱOperatorͷ2छྨʹΘ͔Ε͍ͯΔ • Developer • Operator !54 ,OBUJWF4FSWJOHͷར༻ऀ͸Ͳ͏͍͏ϖϧιφ͔

  55. • ΠϯϑϥΛҙࣝͤͣʹεςʔτϨεͳΞϓϦέʔγϣϯΛ։ൃɾ࣮ ߦ͢ΔΤϯδχΞ • HobbyistɺBackend SWEɺFull stack SWEɺSREͳͲ • ϢʔβʔετʔϦʔྫ

    • ෳ਺ͷίʔυΛσϓϩΠ • มߋͷϩʔϧόοΫ • ΞϓϦέʔγϣϯͷ؂ࢹ !55 %FWFMPQFS
  56. • Knative ServingͱKubernetesͷಋೖɾ؅ཧ΍૊৫ϙϦγʔɺηΩϡ ϦςΟύονͷద༻ʹϑΥʔΧε • HobbyistɺCluster administratorɺSecurity EngineerͳͲ • ϢʔβʔετʔϦʔ

    • Knative ServingΫϥελʔΛ࡞੒͢Δ • Ϧιʔεར༻ʹ੍͍ͭͯޚͨ͠Γ՝ۚ͢Δ • ΞϓϦέʔγϣϯͷ؂ࠪ΍ύονద༻ !56 0QFSBUPS
  57. • ยํͷࢹ఺͕͚͍ܽͯΔͱɺยํʹෛՙ͕͔͔Δ • ΞϓϦέʔγϣϯ։ൃऀ͸շదʹ։ൃʹઐ೦Ͱ͖Δ • ϓϥοτϑΥʔϜͷӡ༻ଆ͸ϓϥοτϑΥʔϜʹઐ೦Ͱ͖Δ !57 ྆ํͷࢹ఺Λҙ͍ࣝͯ͠Δͷ͸҆৺ײ͕͋Δ

  58. ·ͱΊ

  59. • Knative Servingͷΰʔϧ͸ɺPaaS/FaaSͷ֓೦ΛؚΉαʔόʔϨε ϫʔΫϩʔυͷͨΊͷAPIͱπʔϧΛఏڙ͢Δ͜ͱ • 2018೥9݄࣌఺Ͱ͸ΞʔΩςΫνϟͱAPIͷΈఏڙ͞Ε͍ͯΔঢ় گɻʢ·ͩެࣜͰ͸ͳ͍͕ʣCLIπʔϧ͕ొ৔࢝͠Ί͍ͯΔ • IaaSɺCaaSɺPaaSͱ͍ͬͨج൫ٕज़ͷԆ௕ઢ্ʹ͋ΔϓϩμΫτ ͰɺKnativeͰ͸ͳͯ͘΋͍͍͕ߟ͑ํ͸஌͓ͬͯ͘ͱΑ͍ͱࢥ͏

    !59 ·ͱΊ
  60. We are hiring! Senior Software Engineer Software Engineer (Site Reliability)

    Senior Software Engineer (Site Reliability)