Cloud Native Journy with Kubernetes

Bf5ee9059859ed5d855b5ff4680e63e2?s=47 track3jyo-hama
February 01, 2019

Cloud Native Journy with Kubernetes

Cloud Native Kansai #1 Feb 1, 2019
Cloud Native Hiroshima #2 Mar 8, 2019

Bf5ee9059859ed5d855b5ff4680e63e2?s=128

track3jyo-hama

February 01, 2019
Tweet

Transcript

  1. Cloud Native Journey with Kubernetes Cloud Native Kansai #1 Feb

    1, 2019 Hama Shinichi(@track3jyo)
  2. WHO?? • Hama Shinichi(@track3jyo) • Kobe Digital Labo Inc. -

    Cloud Native Team • Senior Cloud Architect • Cloud Native Kansai Organizer • Tech books,Rakugo!
  3. Agenda 1. Benefits of Containers and kubernets 2. Kubernetes overview

    3. What's Cloud Native 4. Cloud Native Journy With Kubernetes
  4. Q: Do you use kubernetes for your business?

  5. Q: How well do you use containers for your business?

  6. Purpose of using containers and kubernets • ίϯςφΛΠϯϑϥٕज़ͱଊ͑ͯ·ͤΜ͔ʁ • ίϯςφ͸ΞϓϦέʔγϣϯͷσϓϩΠʹಛԽٕͨ͠

    ज़ • ΞϓϦͱΠϯϑϥΛؚΜͩϙʔλϏϦςΟͷඇৗʹߴ ͍ശ %JHJUBMUSBOTGPSNBUJPO%9 "HJMFEFWFMPQNFOU .JDSPTFSWJDF %FW0QT
  7. What I think about Microservice And Container Ϗδωεڝ૪ྗͷ͋Διϑτ΢ΣΞΛϦϦʔε͢Δ Ϗδωεڝ૪ྗΛߴΊΔͨΊʹ͸εϐʔυײ͕େ੾ εϐʔυײΛϚΠΫϩαʔϏεΞʔΩςΫνϟͱ

    *NNVUBCMFͳΠϯϑϥʹΑ࣮ͬͯݱ͢Δ ϚΠΫϩαʔϏεʹΑΔಠཱɾཱࣗͨ͠νʔϜ࡞ΓͰ ࣗ૸ՄೳͳνʔϜ͕εϐʔυײΛੜΈग़͢
  8. Can you use Docker as it is in production? •

    ίϯςφӡ༻͢Δ্Ͱͷ՝୊ ෳ਺/PEFͷ؅ཧ ΦʔτεέʔϦϯά ΤίγεςϜͱͷ࿈ܞͳͲͳͲ αʔϏεσΟεΧόϦ ࢮ׆؂ࢹηϧϑώʔϧϯά ίϯςφͷΞοϓσʔτ EFQMPZ εέδϡʔϦϯά
  9. Kubernetes overview Kubernetes • ίϯςφԽ͞ΕͨΞϓϦέʔγϣϯ ͷdeploy,ઃఆ,؅ཧΛࣗಈతʹߦ͏ OSS(ΦʔέετϨʔγϣϯ) • ͢΂ͯͷίϯςφΛେن໛ʹ؅ཧͰ͖ΔΑ͏ʹ͢Δ •

    ߏ੒৘ใ͸yamlͰએݴతʹهड़͠ɺAPIͰొ࿥/ߋ৽ • CNCF͕ϗετ(ݩ͸Google͕ར༻͍ͯͨ͠Borg)
  10. yamlͰએݴతʹهड़

  11. kubernetes͸ ΞϓϦέʔγϣϯίϯςφͷঢ়ଶΛ ႈ౳తʹ؅ཧͯ͘͠ΕΔ

  12. Kubernetes overview ɾ ɾ Worker Master Client(kubectl) etcd kube-controller-manager kube-scheduler

    Deployment API ReplicaSet API Pod API Deploy ment Cotroller Replica Set Cotroller kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kube-api-server kube-proxy kube-proxy kube-proxy LVCFSOFUFTͷ DMVTUFSΛ؅ཧ͢Δ $POUSPM1MBOF ࣮ࡍʹΞϓϦέʔγϣϯ͕ల։͢ ΔDMVTUFS܈ Node1 Node2 Node n
  13. Kubernetes overview ɾ ɾ Worker Master Client(kubectl) etcd kube-controller-manager kube-scheduler

    Deployment API ReplicaSet API Pod API Deploy ment Cotroller Replica Set Cotroller kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kube-api-server kube-proxy kube-proxy kube-proxy LVCFSOFUFTͷ DMVTUFSΛ؅ཧ͢Δ $POUSPM1MBOF ࣮ࡍʹΞϓϦέʔγϣϯ͕ల։͢ ΔDMVTUFS܈ Node1 Node2 Node n kube-api-serverΛܦ༝ͯ͠ શͯͷ؅ཧΛߦ͏
  14. Kubernetes overview ɾ ɾ Worker Master Client(kubectl) etcd kube-controller-manager kube-scheduler

    Deployment API ReplicaSet API Pod API Deploy ment Cotroller Replica Set Cotroller kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kube-api-server kube-proxy kube-proxy kube-proxy Node1 Node2 Node n ᶃΫϥΠΞϯτ͔Βapply ϦΫΤετ
  15. Kubernetes overview ɾ ɾ Worker Master Client(kubectl) etcd kube-controller-manager kube-scheduler

    Deployment API ReplicaSet API Pod API Deploy ment Cotroller Replica Set Cotroller kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kube-api-server kube-proxy kube-proxy kube-proxy Node1 Node2 Node n ᶄݕ஌ͯ͠ReplicaSet APIΛݺͼग़͢
  16. Kubernetes overview ɾ ɾ Worker Master Client(kubectl) etcd kube-controller-manager kube-scheduler

    Deployment API ReplicaSet API Pod API Deploy ment Cotroller Replica Set Cotroller kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kube-api-server kube-proxy kube-proxy kube-proxy Node1 Node2 Node n ᶅݕ஌ͯ͠PodAPIΛݺͼग़ ͢.(͜ͷ࣌Ͳͷnodeʹ഑ஔ͢ Δ͔͸ະఆ)
  17. Kubernetes overview ɾ ɾ Worker Master Client(kubectl) etcd kube-controller-manager kube-scheduler

    Deployment API ReplicaSet API Pod API Deploy ment Cotroller Replica Set Cotroller kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kube-api-server kube-proxy kube-proxy kube-proxy Node1 Node2 Node n ᶆScheduler͕ݕ஌͠഑ஔઌ NodeΛܾΊɺ࠶౓Pod API ΛݺͿ
  18. Kubernetes overview ɾ ɾ Worker Master Client(kubectl) etcd kube-controller-manager kube-scheduler

    Deployment API ReplicaSet API Pod API Deploy ment Cotroller Replica Set Cotroller kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kube-api-server kube-proxy kube-proxy kube-proxy Node1 Node2 Node n ᶇKubelet͕ࣗNodeͰͷPod ࡞੒໋ྩΛݕ஌ͯ͠ɺPod(ί ϯςφ܈)Λ࡞੒
  19. Kubernetes overview ɾ ɾ Worker Master Client(kubectl) etcd kube-controller-manager kube-scheduler

    Deployment API ReplicaSet API Pod API Deploy ment Cotroller Replica Set Cotroller kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kubelet Container Runtime (ex:Docker) Pod
 (Container܈) kube-api-server kube-proxy kube-proxy kube-proxy Node1 Node2 Node n ᶈPodͷεςʔλεΛ൓ө͢Δ
  20. Kubernetes can do 1. ෳ਺ϗετͷ؅ཧɺίϯςφͷεέδϡʔϦϯάɻ ʢΠϯϑϥͷந৅ԽɺϦιʔεͷޮ཰త׆༻ʣ 2. ো֐࣌ͷηϧϑώʔϦϯάʢ؂ࢹίετ࡟ݮʣ 3. αʔϏεσΟεΧόϦ

    4. ϩʔυόϥϯγϯά 5. ϩʔϦϯάΞοϓσʔτ 6. etc...
  21. Kubernetes͸ MicroserviceΞʔΩςΫνϟύλʔϯ ͷKernelͱͳΔ

  22. CNCF overview • CNCF͸Kubernetesͱͱ΋ ʹൃ଍ • KubernetesΛத৺ʹCNCF ͷ؅ཧ͢ΔϓϩδΣΫτ͕ ͦΕʹ෇ਵ͢ΔΤίγες Ϝͱ֦ͯ͠େ͍ͯ͠Δ

  23. CNCF Projects Graduated Projects Incubating Projects Sandbox Projects

  24. What's Cloud Native?? • ༷ʑͳΫϥ΢υ(ϕϯμʔϨε)ͷ্Ͱ֦ுੑͷߴ͍ΞϓϦέʔγϣϯΛߏ ங͓Αͼ࣮ߦ͢ΔͨΊͷྗΛ૊৫ʹఏڙ͢Δ΋ͷ https://github.com/cncf/toc/blob/master/DEFINITION.md ྫɿίϯςφ,ϚΠΫϩαʔϏε&αʔϏεϝογϡ,ImmutableͳΠϯϑϥ,એݴతͳAPI࣮ߦ

  25. Why "Cloud" Native • ΋ͪΖΜΦϯϓϨϛεͰ΋Kuberenetes͸ར༻Մೳ • Cloud্Ͱk8sಈ͔͢͜ͱͰɺͦͷbenefitΛΑΓڗडͰ ͖Δ Cloud͕ຊ౰ͷҙຯͰCloudͨΓ͏ΔͨΊͷKuberenets

  26. In On-premise LB1 LB2 Admin LB1 DB-master cache,session1 cache,session2 App1

    App2 App3 App4 Admin1 Admin2 DB-replica1 DB-replica2 Nat&Batstion
  27. In Cloud LB Admin LB1 App1 App2 App3 App4 Admin1

    Admin2 DB-master DB-replica1 DB-replica2 cache,session1 cache,session2 Internet Gateway Nat bastion Nat VPC AZ-a AZ-b
  28. In Cloud LB Admin LB1 App1 App2 App3 App4 Admin1

    Admin2 DB-master DB-replica1 DB-replica2 cache,session1 cache,session2 Internet Gateway Nat bastion Nat VPC AZ-a AZ-b ຊ౰ʹ͜ΕͰܹมͨ͠ͷͰ͠ΐ͏͔ʁʁ
  29. CloudʹӢ ͑ɺ΄ΜͱӢͷ্?

  30. ௨ఱֳͷ্͘Β͍͡Όͳ͍ʁ

  31. ๻͕ͨͪຊ౰ʹ࡞Γ͍ͨ΋ͷ Ϗδωεͱͯ͠׬੒͍ͤͨ͞΋ͷ͸ʁ

  32. Is it like this? • ͜͏͍͏ͷͰ͢ΑͶ? • ඞཁͳ΋ͷ͚ͩΛૉૣ͘࡞ͬͯϏδωε΍ੈͷதʹ impactΛ༩͑Δੈք $BSU

    0SEFS 1SPEVDU 'SPOU 1BHF )JTUPSZ "VUIFOUJDBUJPO BOE BVUIPSJ[BUJPO 1BZNFO U 4IJQQJO H 4FBSDI Πϯϑϥͱ͍͏֓೦
  33. Realize Cloud Native with Kuberenetes • CloudͷڧྗͳAuto ScaleػೳͰNodeࣗମΛந৅Խ • Ϋϥ΢υ্ͰKuberenetesΛಈ͔͢͜ͱͰඞཁͳϦιʔ

    ε͸ඞཁͳ෼͚ͩىಈ͍ͯ͘͠ੈք Node 01 Node 02 Node 03 pod API-1 pod API-1 pod API-1 pod API-1 pod API-2 pod DB ɾɾɾɾ Node N pod API-1 pod DB ඞཁͳ࣌ʹىಈ/࡟আ Worker Clusterͱ͍͏֓೦
  34. ͯ͞ɺࠓ౓ͦ͜׬શʹந৅Խ͞Εͨ Ͱ͠ΐ͏͔ʁ

  35. ͞Εͯ·ͤΜɻ

  36. Components of Kuberenetes • Master-workerɻඞཁͳͷ͸Worker͚ͩͳ͸ͣ • Masterͷ؅ཧந৅Խ͞Εͯ·ͤΜ • ͦ΋ͦ΋͜ͷKubernetesͷ؀ڥ͸୭͕Ͳ͏࡞Δͷʁ •

    ߏங͕ந৅Խ͞Εͯ·ͤΜ Master΋ ந৅Խ͍ͨ͠
  37. Kubernetes Cloud Services • GKE 2014೥11݄ϩʔϯν 2015೥08݄ GA • AKS

    2017೥02݄ϩʔϯν 2018೥06݄ GA • EKS 2017೥11݄ϩʔϯν 2018೥06݄ GA Google GKE (Google Kubernetes Engine) Azure AKS (Azure Kubernetes Service) Amazon EKS (Elastic Container Service for Kubernetes)
  38. Kubernetes Cloud Services • جຊ࣮ݱ͍ͨ͜͠ͱ͸ಉ͡Ͱ͋Δ • MasterίϯϙʔωϯτͷManaged • ͦΕͧΕͰಛ௃ͩͬͨΓɺͪΐͬͱͨ͠࢖͍উख͕ ҧ͏

  39. Cloud Native Journy With Kubernetes • ͍͟ Kubernets!! ͱͳͬͨޙ ✓

    ͲͷΑ͏ʹKubernetesΛಋೖ͍ͯ͘͠΂͖͔ʁ ✓ KubernetesΛಋೖޙɺͲͷΑ͏ʹ͢͢Ί͍ͯ͘΂͖͔ʁ ✓ ͲͷΑ͏ʹKubernetesΛ૊৫ʹਁಁͤ͞Δ͔ʁ
  40. Cloud Native Trail Map • CNCF͕ਪ঑͢Δɺا ۀͷͨΊͷ ɹCloud Native Խ΁

    ɹͷεςοϓΛදͨ͠ਤ • 1~3·Ͱ͕ඞਢϑϩʔ Ͱɺ4Ҏ߱͸Φϓγϣ ϯѻ͍
  41. 1. CONTAINERIZATION 1. ·ͣࣗ෼ͰίϯςφΛѻ ͏ɻDockerfileΛॻ͘ 2. ద੾ͳapp෼ׂΛߦ͍ɺෳ ਺ίϯςφԽ͠ɺϚΠΫϩ αʔϏεͷ౔୆Λͭ͘Δ 3.

    ίϯςφͷΠϝʔδ΍yaml ΛνʔϜͰڞ༗
  42. 2. CI/CD 4. νʔϜ಺Ͱίϯςφ׳Ε͕ ͞ΕΔͱɺCI/CDͷύΠϓ ϥΠϯΛ༻ҙͯ͠ίϯςφ ΛShip͢Δ 5. ࠷ऴతʹຊ൪؀ڥʹ΋ࣗಈ ͰίϯςφΛship͢Δɻί

    ϯςφͷϙʔλϏϦςΟͷ ߴ͞Λ׆͔͢࢓૊Έͮ͘Γ Amazon ECR Amazon EC2 docker image push docker image pull & deploy
  43. 3. ORCHESTRAION & APPLICATION DEFINITION 6. ຊ൪ͰίϯςφΛେن໛ల ։͢ΔͨΊʹΦʔέετϨʔ γϣϯΛಋೖ(kubernetes) ※͜ͷࡍɺՄೳͳΒManaged

    Service(GKE,EKS,AKS)Λར༻͠ɺ Ͱ͖ΔݶΓOps͢ΔൣғΛݮΒ͢ Node 01 Node 02 Node 03 pod API-1 pod API-1 pod API-1 pod API-1 pod API-2 pod API-3
  44. 4~10. After that Cloud Native's way will continue ... 7.

    ӡ༻্ɺൃੜ͢Δख࡞ۀ΍ ɺ ՝୊ΛɺCNCFͷProjects ΍֤ࣾΫϥ΢υϕϯμʔͷ ΤίγεςϜͰຒΊ͍ͯ͘ • ྫɿfluentd(logging)ɺ Prometheus(monitoring)ɺ envoy&Istio(ServiceMesh)
  45. Cloud Native Trail Map

  46. Future Cloud Native • ࣗ཯తͳΞʔΩςΫνϟɺࣗ཯తͳDeployͱ͍͏Α͏ ʹkubernetesΛϕʔεͱͯ͠ɺຊ౰ʹҙຯͰਓ͕खΛग़ ͞ͳ͍͍ͯͯࣗ͘཯తCloud NativeʹਐΜͰ͍͘ -# &OWPZ

    &OWPZ &OWPZ 7 7 .- access log access log
  47. Future Cloud Native • WEBܥͷΈͳΒͣɺFaaSɺIoTɺML͜͏͍ͬͨͪΐͱ ҧͬͨࢹ఺Ͱͷ׆༻͕ਐΈɺࣗ཯ਆܦͱͯ͠ͷ kuberenetes NativeԽ͕ਐΉ

  48. Conclusion • Kubernetes͸MicroserviceΞʔΩςΫνϟύλʔϯͷ KernelͱͳΔ • Cloud Native Trail MapΛาΈɺࣗ཯తͳγεςϜͱ૊ ৫ԽΛ໨ࢦ͢

    • ׬શࣗ཯ܕͷDevOps͕kubernetesΛϕʔεΛ࣮ݱ͢Δ ະདྷ͸͍ۙ
  49. WE ARE HIRING!!!

  50. Thank you for your attention!! please follow me @track3jyo