Save 37% off PRO during our Black Friday Sale! »

Lecture__1.pdf

30d97c8383a531c459ac210540b4eace?s=47 ry
February 10, 2020

 Lecture__1.pdf

30d97c8383a531c459ac210540b4eace?s=128

ry

February 10, 2020
Tweet

Transcript

  1. Lecture for today’s theme ry (@URyo_0213) 2020/2/10 Kubernetes Wakaran Tokyo

    #1
  2. Podͷ࡞੒ ղ౴ • metadata Podʹ༩͑Δmetadata - Podʹ`nginx`ͱ͍͏໊લ - ֎෦͔Βͷ໨ҹͱͳΔlabel Λ෇༩͍ͯ͠Δɻ

    • spec.containers Containerͷ৘ใ Container name: nginx image: nginx (version 1.17.5) exported port: 80
  3. Podͱ͸ • WorkloadsϦιʔεͷ࠷খ୯Ґ • 1ͭҎ্ͷίϯςφ͔Βߏ੒͞ΕΔ • Pod಺ͷίϯςφ͸ɺωοτϫʔΫΛڞ༗͢Δ ·ͯΑ… ͲΜͳ࣌ʹPodͷதʹ ෳ਺ίϯςφೖΕΔΜͩʁʁʁ

  4. جຊύλʔϯ • αΠυΧʔύλʔϯ • Ξϯόαμύλʔϯ • Ξμϓλύλʔϯ ~ Ԡ༻ ~

    • ελοΫɾΪϟβʔ • etc…
  5. جຊύλʔϯ • αΠυΧʔύλʔϯ • Ξϯόαμύλʔϯ • Ξμϓλύλʔϯ ~ Ԡ༻ ~

    • ελοΫɾΪϟβʔ • etc…
  6. αΠυΧʔύλʔϯ • PodͷதͰɺmainίϯςφ(ΞϓϦέʔγϣϯ ౳)ͷػೳ֦ு ΍ิॿΛ͢ΔίϯςφΛ૊ΈࠐΉύλʔϯ ྫ) αΠυΧʔproxy Proxy App http://10.200.100.20

    http://localhost App Pod
  7. Ξϯόαμύλʔϯ • ֎෦ͷαʔϏεͷ஥հ໾ͱͳΔίϯςφΛಉҰPod಺ʹ࣋ͭ ύλʔϯ ྫ) γϟʔσΟϯάΞϯόαμ App Ambassador http://localhost:port shard

    #3 shard #2 shard #1 App Pod
  8. Ξμϓλύλʔϯ • ֎෦ͷαʔϏε(؂ࢹ΍Logging)͔Βͷ൚༻తͳΠϯλʔϑΣ ΠεΛఏڙ͢ΔίϯςφΛ૊ΈࠐΉύλʔϯ ྫ) Redis Exporter + Prometheus Redis

    Adapter - Exporter EternalService - Prometheus
  9. Workloads Ϧιʔεͱ͸???

  10. Workloads Ϧιʔε • Pod • ReplicaSet • Deployment • DaemonSet

    • StatefulSet • Job • CronJob
  11. Workloads Ϧιʔε • Pod • ReplicaSet • Deployment • DaemonSet

    • StatefulSet • Job • CronJob
  12. ReplicaSet ࢦఆ͞Εͨཧ૝ͷϨϓϦΧ਺ʹ͢ΔͨΊʹPodͷ࡞ ੒ͱ࡟আΛߦ͏Ϧιʔε ྫ) replica = 4

  13. ReplicaSet manifest • Selector spec.template.metadata.label Λࢀর͠ɺReplicaΛੜ੒͢Δର৅ ͷPodΛબ୒͢Δɻ ɹ(spec.selector.matchLabelsͱ spec.template.labels͕Ұக͠ͳ͍ɹ ɹ৔߹ɺError͕ग़ͯ࡞੒͕Ͱ͖ͳ͍)

    • templateԼ͸PodͷmanifestͱҰॹ
  14. Deployment Deployment͸ReplicaSetͷ؅ཧΛ͠ɺϩʔϦϯά Ξοϓσʔτ΍ϩʔϧόοΫͳͲͷએݴతͳΞοϓ σʔτػೳΛఏڙ ྫ) replica = 4 (RollingUpdateத) Deployment

    New Old
  15. Deployment manifest • ReplicaSetͱಉ༷ • UpdateStrategy(spec.strategy) ʹؔͯ͠͸লུ

  16. DaemonSet ReplicaSetͷಛघܥ ֤Nodeʹ1ͭͣͭ഑ஔ͢ΔͨΊɺReplica਺ͷࢦఆ ͕Ͱ͖ͳ͍ɻ( ഑ஔͨ͘͠ͳ͍Node͕͋Δ৔߹ɺ Node Anti-Affinity౳Ͱ੍ޚՄೳ)

  17. DaemonSet manifest • ReplicaSetͷΑ͏ͳspec.replica͕ ࢦఆͰ͖ͳ͍͕ɺͦΕҎ֎͸ಉ༷

  18. StatefulSet ReplicaSetͷಛघܥ εέʔϦϯά(ݮΒ࣌͢͸1൪େ͖͍ΠϯσοΫε ͔Β)΍ɺPodͷ࡞੒(1ͭͣͭॱʹ࡞੒)ͳͲڍಈʹ ҧ͍͕͋Δɻ [ReplicaSet໊] - [ϥϯμϜͳจࣈྻ] [StatefulSet໊] -

    [index൪߸] RepliaSet StatefulSet
  19. StatefulSet manifest • جຊ͸ReplicaSetͱҰॹ • spec.serviceNameʹͯservice໊ Λࢦఆ͢Δඞཁ͕͋Δɻ

  20. Replicaͷ࡞੒ ղ౴ • ΞϓϦέʔγϣϯΛಈ͔͢ࡍɺ DB౳ͱ͸ҧ͍ɺॊೈͳΞοϓ σʔτͷઓུΛऔΓ͍ͨɻ (× StatefulSet, DaemonSet) •

    Ϧιʔε౳Λߟྀͨ͠Node഑ஔ ౳͕ඞཁʹͳΔɻ (× DaemonSet) ΑͬͯDeploymentΛબ୒