Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

Podͷ࡞੒ ղ౴ • metadata Podʹ༩͑Δmetadata - Podʹ`nginx`ͱ͍͏໊લ - ֎෦͔Βͷ໨ҹͱͳΔlabel Λ෇༩͍ͯ͠Δɻ • spec.containers Containerͷ৘ใ Container name: nginx image: nginx (version 1.17.5) exported port: 80

Slide 3

Slide 3 text

Podͱ͸ • WorkloadsϦιʔεͷ࠷খ୯Ґ • 1ͭҎ্ͷίϯςφ͔Βߏ੒͞ΕΔ • Pod಺ͷίϯςφ͸ɺωοτϫʔΫΛڞ༗͢Δ ·ͯΑ… ͲΜͳ࣌ʹPodͷதʹ ෳ਺ίϯςφೖΕΔΜͩʁʁʁ

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

Ξμϓλύλʔϯ • ֎෦ͷαʔϏε(؂ࢹ΍Logging)͔Βͷ൚༻తͳΠϯλʔϑΣ ΠεΛఏڙ͢ΔίϯςφΛ૊ΈࠐΉύλʔϯ ྫ) Redis Exporter + Prometheus Redis Adapter - Exporter EternalService - Prometheus

Slide 9

Slide 9 text

Workloads Ϧιʔεͱ͸???

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

Deployment Deployment͸ReplicaSetͷ؅ཧΛ͠ɺϩʔϦϯά Ξοϓσʔτ΍ϩʔϧόοΫͳͲͷએݴతͳΞοϓ σʔτػೳΛఏڙ ྫ) replica = 4 (RollingUpdateத) Deployment New Old

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

StatefulSet manifest • جຊ͸ReplicaSetͱҰॹ • spec.serviceNameʹͯservice໊ Λࢦఆ͢Δඞཁ͕͋Δɻ

Slide 20

Slide 20 text

Replicaͷ࡞੒ ղ౴ • ΞϓϦέʔγϣϯΛಈ͔͢ࡍɺ DB౳ͱ͸ҧ͍ɺॊೈͳΞοϓ σʔτͷઓུΛऔΓ͍ͨɻ (× StatefulSet, DaemonSet) • Ϧιʔε౳Λߟྀͨ͠Node഑ஔ ౳͕ඞཁʹͳΔɻ (× DaemonSet) ΑͬͯDeploymentΛબ୒