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

Kubernetesの事始め

Iku Yamamoto
February 02, 2018

 Kubernetesの事始め

Kubernetes(k8s)の初学者や導入検討者向けの資料

Iku Yamamoto

February 02, 2018
Tweet

Other Decks in Technology

Transcript

  1. • ໊લ: ࢁຊ ҭ(twitter_id: @Mt_mo1019) • ݱࡏͷ࢓ࣄ • RDB PaaS։ൃ

    • ࠓ·Ͱ • PostgreSQLͷݕূ etc… Who am I ? 2
  2. Master Server Master Server k8sͷΞʔΩςΫνϟ 5 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server kubectl Pod Pod Pod Pod Auto Deploy
  3. Master Server Master Server k8sͷΞʔΩςΫνϟ 6 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server Pod Pod Pod Pod Crash
  4. Master Server Master Server k8sͷΞʔΩςΫνϟ 7 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server Pod Pod Pod Pod ReDeploy Crash Pod
  5. what is Pod normally 9 Container ex) nginx Pod Container

    ex) exporter, fluentd etc • αʔϏεͱड͚࣋ͭ ϝΠϯͷcontainer • αϒͷcontainer • agentܥͷϓϩηε Λड͚࣋ͭ • sidecarͱݴΘΕΔ
  6. ओͳdeploy manifests 11 ఆٛ ֓ཁ Deployments ҰൠతͳPodͷσϓϩΠ StatefulSets StatefulͳΞϓϦέʔγϣϯͷσϓϩΠ DaemonSet

    Nodeશ୆΁ͷσϓϩΠ Jobs daemonize͠ͳ͍ΞϓϦͷσϓϩΠ CronJob Jobsͷఆظతͳ࣮ߦ Service Pod΁ͷΞΫηε੍ޚ ConfigMap PodʹΠϯδΣΫγϣϯ͢ΔϑΝΠϧఆٛ PersistentVolume ӬଓԽ͢ΔετϨʔδͷఆٛ
  7. Master Server Master Server Deployments 13 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server Pod Pod Replicas=2
  8. Master Server Master Server StatefulSets 15 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server 1st Pod Replicas=2
  9. Master Server Master Server StatefulSets 16 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server 1st Pod Replicas=2 2nd Pod
  10. Master Server Master Server DaemonSet 18 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server Pod Pod Pod
  11. Master Server Master Server Jobs 20 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server Pod Ͳ͔͜ͷNodeͰ࣮ߦ
  12. Master Server Master Server CronJob 22 Master Nodes Nodes(Minion) Master

    Server kubernetes cluster Node Server Node Server Node Server Pod Ͳ͔͜ͷNodeͰJobΛىಈ ఆظ࣮ߦ
  13. Service 24 Nodes(Minion) kubernetes cluster Node Server Node Server Node

    Server Pod Pod Service ͲͷNodeʹΞΫηεͯ͠΋ ݁ͼ͍ͭͨPodʹಧ͘
  14. • ίϯςφͳͷͰىಈ͕ૣ͍ • ։ൃऀ΁ͷ༗ޮͳػೳ͕ଟ͍ • εέʔϧΞ΢τ • ো֐࣌ͷࣗಈFailOver͕Α͍ • CronJobͷΫϥελ੍ޚ

    • ͲͷNodeʹΞΫηεͯ͠΋Podʹ౸ୡͰ͖Δ • Document͕ἧ͍ͬͯΔɻӳޠ͕៉ྷɻ • ॳظֶशίετ͕ߴ͍ ར༻ऀͱͯ͠ͷk8sͷॴײ 31
  15. k8sͷߏஙํ๏ 34 ߏஙํ๏ Pros. Cons. ࣗલͷansible ࣗલͰ࡞ΕΔͷͰॊೈ ௥ै͕େม kubeadm kubenetesຊՈͷϨϙδτϦ

    શͯͷΦϖϨʔγϣϯͷ ίʔυԽΛ໨ࢦ͢ https://github.com/kubernetes/ kubeadm ·ͩ։ൃ్த star਺͸গͳΊ kube-spray star਺͕ଟ͍ ෳ਺ͷύλʔϯʹରԠͯ͠ ͍Δ https://github.com/kubernetes- incubator/kubespray ຊՈϨϙδτϦͰ͸ͳ͍ playbookࣗମ͸ෳࡶ
  16. • ྑ͍ͱ͜Ζ • ։ൃεϐʔυ͕ͱͯ΋ૣ͍ • ػೳ͸ଟ͘ἧ͍ͬͯͯศར • ѱ͍ͱ͜Ζ • ॳظֶशίετ͕ߴ͍

    • ӡ༻ൣғ͕ଟذʹ౉Δ • NW plugin͕Կ͕͍͍͔Θ͔Βͳ͍ • ReadWriteManyʹରԠͨ͠PersistentVolume͕গͳ͍ ॴײ 37