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

kubernetes-seminar

62a14b322f22ab9588702ab2064df63f?s=47 Tomoki Sugiura
May 15, 2019
68

 kubernetes-seminar

62a14b322f22ab9588702ab2064df63f?s=128

Tomoki Sugiura

May 15, 2019
Tweet

Transcript

  1. Kubernetes جૅษڧձ TIBOQV

  2. ͶΒ͍ 2 ˓ ,VCFSOFUFTͷجૅΛֶͼࠓޙͷษڧʹ໾ཱͯͯ΋Β͏ ˓ ,VCFSOFUFTͷ͜ͱΛ޷͖ʹͳͬͯ΋Β͏

  3. Agenda 3  ,VCFSFOFUFTͱ͸  LVCFDUMɾLVCFOTɾLVCFDUY  8PSLMPBETϦιʔε  ೝূͱΞʔΩςΫνϟ

     %JTDPWFSZ-#Ϧιʔε  $POpH4USBHFϦιʔε  0UIFST  ͍͞͝ʹ
  4. Link 4 ˓ ϋϯζΦϯࢿྉ ˔ IUUQTHJUIVCDPNDIF[TIBOQVLTTFNJOBS ˓ ࿅श໰୊ ˔ IUUQTHJUIVCDPNEHLBOBUTJPT$,"%FYFSDJTFT

  5. 1. Kubernetesͱ͸ 5

  6. ಡΈํ 6 ,VCFSOFUFT LT SEL@KIT

  7. History 7

  8. Kubernetes͸ԿΛߦ͏ʁ 8 ˓ ίϯςφͷ؅ཧΛ͍͍ײ͡ʹߦ͏

  9. Kubernetesͷಛ௃ 9 ˓ ϚχϑΣετϑΝΠϧ ˓ εέʔϦϯά ˓ εέδϡʔϦϯά ˓ Ϧιʔε؅ཧ

    ˓ ηϧϑώʔϦϯά ˓ σʔλͷ؅ཧ SEL@KIT
  10. 2. kubectlɾkubensɾkubectx 10

  11. KubeCLIπʔϧࡾॐ࢜ 11 ˓ LVCFDUM ˔ ,VCFSOFUFTʹର͢Δ͋ΔΏΔૢ࡞Λߦͬͯ͘ΕΔίϚϯυ ˔ ࣮ࡍʹ͸,VCFSOFUFTͷ3&45"1*TFSWFSʹରͯ͠ϦΫΤετ Λૹ͍ͬͯΔ ˓

    LVCFOT ˔ OBNFTQBDFͷ੾Γସ͑Λ؆୯ʹͯ͘͠ΕΔ ˓ LVCFDUY ˔ DPOUFYUͷ੾Γସ͑Λ؆୯ʹͯ͘͠ΕΔ
  12. kubectl جຊίϚϯυ 12 ˓ ALVCFDUMHFUϦιʔεA ˔ ࢦఆͨ͠ϦιʔεͷεςʔλεΛऔಘ ˔ ALVCFDUMHFUϦιʔε໊લPZBNMAͰͦͷϦιʔεͷϚ χϑΣετΛݟΔ͜ͱ΋Ͱ͖Δ

    ˓ ALVCFDUMEFTDSJCFϦιʔε໊લA ˔ ໊લͰࢦఆͨ͠ϦιʔεͷৄࡉΛදࣔ
  13. kubectl جຊίϚϯυ 13 ˓ ALVCFDUMBQQMZGϑΝΠϧͷύεA ˔ ϚχϑΣετϑΝΠϧΛΫϥελʹద༻͢Δ ˓ ALVCFDUMSVOΦϓγϣϯA ˔

    ໋ྩతʹϦιʔεΛੜ੒͢Δ ˓ ALVCFDUMDSFBUFϦιʔε໊લA ˔ ࢦఆ໊ͨ͠લͰࢦఆͨ͠ϦιʔεΛ࡞੒ ˔ ࡞੒Ͱ͖ΔϦιʔεͷछྨʹ͸ݶΓ͋Γ
  14. kubectl جຊίϚϯυ 14 ˓ ALVCFDUMEFMFUFϦιʔε໊લA ˔ ࢦఆͨ͠ϦιʔεΛ࡟আ ˔ GͰϚχϑΣετʹهࡌ͞Ε͍ͯΔϦιʔεΛ࡟আ ˓

    ALVCFDUMFYQMBJOϦιʔε ϑΟʔϧυ໊ A ˔ ֤ϦιʔεͷϚχϑΣετϑΝΠϧʹهࡌ͢ΔϑΟʔϧυͷ৘ ใΛදࣔ
  15. kubensɾkubectx 15 ˓ LVCFOT ˔ ΫϥελͷOBNFTQBDFΛҰཡදࣔ ˔ ALVCFOTOBNFTQBDF໊AͰOBNFTQBDFͷ੾Γସ͑ ˓ LVCFDUY

    ˔ ࣗ෼ͷॴ͍࣋ͯ͠ΔίϯςΩετΛҰཡදࣔ ˔ ALVCFDUYίϯςΩετ໊AͰίϯςΩετͷ੾Γସ͑
  16. 3. WorkloadsϦιʔε 16

  17. ུ֓ਤ 17

  18. Pod (po) 18 ˓ 8PSLMPETϦιʔεͷ࠷খ୯Ґ ˓ $POUBJOFS㱨1PE ˓ σβΠϯύλʔϯ ˔

    αΠυΧʔύλʔϯ ˔ Ξϯόαμʔύλʔϯ ˔ Ξμϓλύλʔϯ
  19. ReplicaSet (rs) 19 ˓ SFQMJDBTͰҡ͍࣋ͨ͠1PEͷ ਺Λࢦఆ ˓ 3FQMJDB4FU୯ମͰ࢖͏͜ͱ ͸͋·Γͳ͍ ˔

    ޙड़ͷ%FQMPZNFOUΛ࢖͏
  20. Deployment (deploy) 20 ˓ 3FQMJDB4FUΛ؅ཧ ˔ ϩʔϦϯάΞοϓσʔτ ˔ ϩʔϧόοΫ ˓

    BQQMZ͢Δͱద౰ͳ3FQMJDB4FU Λ࡞੒
  21. DeploymentͷϩʔϦϯάΞοϓσʔτ 21

  22. DeploymentͷϩʔϦϯάΞοϓσʔτ 22

  23. StatefulSet (sts) 23 ˓ σʔλΛӬଓԽ͢Δ࢓૊Έ Λඋ͑Δ ˓ 1PEͷ໊લʹΠϯσοΫε ͕αϑΟοΫεͱͯͭ͘͠

  24. DaemonSet (ds) 24 ˓ ֤ϊʔυʹඞͣҰͭ1PEΛ ഑ஔ͢Δ ˓ /PEF4FMFDUPS౳Λ࢖͑͹ ഑ஔ͠ͳ͍͜ͱ΋Մೳ

  25. Job 25 ˓ ίϯςφΛར༻ͯ͠Ұ౓ݶΓ ͷॲཧΛ࣮ߦͤ͞Δ ˓ ࣮ߦํ๏΍׬ྃ৚݅ΛࢦఆͰ ͖Δ ˔ /ฒྻͰ࣮ߦͯ͠΄͍͠

    ˔ /ճ੒ޭͨ͠Βਖ਼ৗऴྃʹͯ͠ ΄͍͠ ˔ /ճࣦഊͨ͠Β΋͏͠ͳͯ͘ ΋͍͍
  26. CronJob (cj) 26 ˓ +PCΛఆظ࣮ߦ ͯ͘͠ΕΔ

  27. 4. ೝূͱΞʔΩςΫνϟ 27

  28. NamespaceͱRBAC 28

  29. ClusterͱNode 29

  30. MasterNodeͱNode 30

  31. 5. Discovery & LB Ϧιʔε 31

  32. ClusterIPɾExternalIP 32 ˓ $MVTUFS*1 ˔ Ϋϥελ಺෦ͷ*1 ˓ &YUFSOBM*1 ˔ Ϋϥελ֎෦ͱ΋ૄ௨ੑͷ͋

    Δ*1
  33. NodePort 33 ˓ ͦΕͧΕͷ/PEFͷࢦఆ 1PSU΁ͷτϥϑΟοΫΛɼ ͦΕʹඥ͚ͮͨ1PEͷ1PSU ΁సૹ ˓ $MVTUFS*1͸ࣗಈతʹൃߦ

  34. LoadBalancer 34 ˓ Ϋϥελ֎ʹ-#Λ࡞੒ ˔ -#ʹ֎෦ૄ௨ੑͷ͋Δ*1Λ ෇༩

  35. Ingress 35 ˓ -ͷϩʔυόϥϯα ˓ *OHSFTT$POUSPMMFS͕ ผ్ඞཁ

  36. 6. Config & Strage Ϧιʔε 36

  37. Secret 37 ˓ ओʹػີ৘ใͷอ؅ʹ࢖͏ ˓ ,FZ7BMVFͷܗͰهड़ ˓ 7BMVF͸CBTFͰΤϯ ίʔυ

  38. ConfigMap (cm) 38 ˓ 4FDSFUͷػີ৘ใ͡Όͳ͍൛ ˓ ϑΝΠϧͷத਎Λॻ͍ͯͦΕ ΛϚ΢ϯτͤ͞Δ࢖͍ํ΋Α ͘͢Δ

  39. PersistentVolume (pv) 39 ˓ ӬଓԽྖҬͱͯ֬͠อ ˓ ༧ΊετϨʔδΛ༻ҙ͓ͯ͘͠

  40. PersistentVolumeClaim (pvc) 40 ˓ 1FSTJTUFOU7PMVNF$MBJN ܦ༝Ͱ17Λ֬อ͢Δ ˓ 17$ͷཁٻʹ߹ͬͨ17͕ ෷͍ग़͞ΕΔ

  41. 7. Others 41

  42. NetworkPolicy 42 ˓ 1PEಉ࢜ͷ௨৴Λ੍ޚ ˔ ྫ ಉ͡/BNFTQBDF಺ͷ1PE ͔͠௨৴Ͱ͖ͳ͍Α͏ʹ͢Δ

  43. NodeSelectorɾNodeAffinity 43 ˓ 1PEͷεέδϡʔϦϯά ઌΛࢦఆ ˓ 1PETQFD಺ʹهड़ ˓ /PEF"⒏OJUZͷํ͕ΑΓ ࡉ͔͍৚݅ઃఆ͕Մೳ

  44. TaintɾTolerations 44 ˓ 5BJOUʢԚΕʣ ˔ 1PEΛεέδϡʔϦϯά ͤ͞ͳ͍ ˓ 5PMFSBUJPOTʢ׮༰ʣ ˔

    5BJOUͷ͍ͭͨ/PEFʹ΋ εέδϡʔϦϯά͞ΕΔ
  45. Ϧιʔεͷ੍ݶ 45 ˓ ࢖༻͢ΔϚγϯϦιʔεͷ ্ݶͱԼݶΛઃఆͰ͖Δ

  46. 8. ͍͞͝ʹ 46

  47. ঺հͰ͖ͳ͔ͬͨ͜ͱ 47 ˓ )PSJ[POUBM1PE"VUPTDBMFS ˓ 7FSUJDBM1PE"VUPTDBMFS ˓ %SBJOɼ$PSEPOɼ6ODPSEPO ˓ 1PE%JTSVQUJPO#VEHFU

    ˓ $VTUPN3FTPVSDF%FpOJUJPO ˓ $MVTUFS3PMFɼ$MVTUFS3PMF#JOEJOH ˓ 4FSWJDF"DDPVOU FUD
  48. ࢀߟਤॻ 48 ˓ ,VFCFSOFUFT׬શΨΠυ ˔ ,VCFSOFUFTͷجຊཁૉΛ໢ཏ ͍ͯ͠Δ ˔ αϯϓϧίʔυɼਤ΋ଟ͘Θ͔ Γ΍͍͢

    ˓ ଞʹ΋,VCFSOFUFTຊ͸͋Δ ˔ ΋͠ങͬͨਓ͕͍ͨΒײ૝ڭ͑ ͍ͯͩ͘͞
  49. Πϕϯτ& Slack 49 ˓ Πϕϯτ ˔ DPOOQBTTͰௐ΂ΔͱΘΓͱώοτ͢Δ ˔ ,VCFSOFUFT.FFUVQ5PLZPͳͲϏσΦ഑৴͍ͯ͠ΔΠϕϯτ΋͋Δ ˓

    4MBDL ˔ ,VCFSOFUFTϢʔβͷͨΊͷϫʔΫεϖʔε͕͋Δ ˔ ೔ຊਓͷͨΊͷνϟϯωϧ΋͋Δ ˔ ௐ΂ͯ΋Θ͔Βͳ͍͜ͱ͸͜͜ʹ౤͛ͯΈΔͷ΋Α͍
  50. 50 ͓ർΕ༷Ͱͨ͠