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

managed_Kubernetes_on-premises.pdf

yuhara
December 05, 2018

 managed_Kubernetes_on-premises.pdf

yuhara

December 05, 2018
Tweet

More Decks by yuhara

Other Decks in Technology

Transcript

  1. γεςϜ֓ཁ Generator API Management Console Load Barancer Ingress Service Deployment

    Namespace Kubernetes APIΛ௨ͯ͡ Namespace΍ඞཁͱͳΔϦιʔ ε܈Λ࡞੒
  2. γεςϜ֓ཁ Generator API Management Console Load Barancer Ingress Service Deployment

    Namespace GitLab APIΛ௨ͯ͡ϓϩδΣΫτ ͷ࡞੒ʢςϯϓϨʔτ͔ΒͷΠϯ ϙʔτʣͱCI/CD༻ͷVariablesͷ ઃఆ Container Registry΋ར༻Մ
  3. γεςϜ֓ཁ Generator API Management Console Load Barancer Ingress Service Deployment

    Namespace LoadBalancerʢk8sͷ֎ʣͷઃఆ Λมߋ͠ΫϥΠΞϯτ͔ΒͷΤϯυ ϙΠϯτΛఏڙ
  4. Kubernetes Resouce Generator •  KubernetesͷϦιʔε܈Λ࡞ΔͨΊʹಠࣗʹ࡞੒ͨ͠API •  YAMLϚχϡϑΣετΛapply͍ͯ͠ΔΑ͏ͳΠϝʔδ •  Kubernetes client

    pythonΛ࢖༻ •  Officialʹఏڙ͞Ε͍ͯΔgo΍pythonͷClient Library ɹɹhttps://github.com/kubernetes-client/python ɹɹhttps://github.com/kubernetes/client-go •  Python FlaskͰREST APIԽ
  5. γεςϜ֓ཁ Developer Load Barancer Ingress Service Deployment Namespace Container Registry

    GitLab CI͕։࢝͞Εk8s্ͷrunner ʹରͯ͠Pipelineͷ࣮ߦΛ໋ྩ
  6. γεςϜ֓ཁ Developer Load Barancer Ingress Service Deployment Namespace workspace Container

    Registry #01 Build Stage Kubernetes্ͰίϯςφϏϧυ ༻ͷίϯςφΛ࣮ߦ
  7. γεςϜ֓ཁ Developer Load Barancer Ingress Service Deployment Namespace workspace Container

    Registry #01 Build Stage GitLabͷProjectΛclone͠ DockerfileΛݩʹΠϝʔδϏϧυ
  8. γεςϜ֓ཁ Developer Load Barancer Ingress Service Deployment Namespace workspace Container

    Registry #01 Build Stage ϏϧυΠϝʔδΛGitLab Container RegistryʹPush
  9. γεςϜ֓ཁ Developer Load Barancer Ingress Service Deployment Namespace workspace Container

    Registry #02 Deploy Stage Runner͔ΒDeploy༻ͷίϯςφ Λىಈɻ Kubernetes APIΛ௨ͯ͡ Deploymentʹରͯ͠Rolling updateΛ໋ྩ
  10. GitLab & GitLab CI •  GitLabɺGitLab Container RegistryΛར༻ •  CI/CDδϣϒ͸Kubernetes

    executorͰ࣮ߦ •  .gitlab-ci.ymlͰύΠϓϥΠϯΛఆٛ͠ɺ࣮ߦ͍ͨ͠ॲཧͱɺͦͷॲཧΛ ࣮ߦ͢ΔϕʔεΠϝʔδΛબ୒ʢServerlessͳײ֮ʣ •  εςʔδຖʹtagΛࢦఆ͢Δ͜ͱͰɺDevelop/Staging/Productionͱ ͍ͬͨܗͰ࣮ߦ؀ڥΛ෼͚ΒΕΔ Build to develop stage: build only: - /^develop.*/ image: gcr.io/kaniko-project/executor:debug script: - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination …(লུ) tags: - develop .gitlab-ci.ymlͷҰ෦Λൈਮ
  11. Kubernetes ExecutorΛ࢖ͬͨPipeline •  #01 Build Stage •  Builderͱͯ͠͸dind(docker in docker)

    ͔ kanikoͷબ୒͕Մ •  kaniko͸Google͕։ൃ͢ΔϏϧμʔɻKubernetes্ͰΠϝʔδ Ϗϧυ͢Δ͜ͱΛ૝ఆ͠privilegedແ͠ͰϏϧυՄ ɹɹhttps://github.com/GoogleContainerTools/kaniko •  #02 Deploy Stage •  Kubernetes client pythonͰ࡞੒ͨ͠ಠࣗπʔϧΛ࢖༻ •  Rolling update ΍ ຊ൪ͰͷB/G DeploymentɺRollback౳ʹର Ԡ
  12. FeatureϒϥϯνରԠ •  FeatureϒϥϯνΛ࡞੒͢Δ ͱͦΕʹରԠͨ͠Endpointͱ Service/DeploymentΛࣗಈ తʹߏ੒ •  GitLab CIͱ࿈ಈ͠ϒϥϯν໊ ʹԠͨ͡Development͕ߋ

    ৽͞ΕΔ Ingress Service Deployment Service Deployment Service Deployment a.com b.com c.com develop branch feature/a branch feature/b branch
  13. •  Push Code, Not Container •  ӡ༻͸ϓϧϦΫΤετͰ࣮ߦ͞ΕΔ Weaveworks : Alexis

    Richardsonࢯ •  kubectl౳ͷίϚϯυϥΠϯπʔϧ͸࢖Θͳ͍ʢGitૢ࡞ͷΈʣ •  GitͱγεςϜͷঢ়ଶ͕ඞͣ౳͍͠ɺGitΛਅͱ͢Δߟ͑ •  γεςϜΛGit؅ཧ͢Δ GitOps
  14. ·ͱΊ •  Kubernetes্ͷϦιʔε܈΍Load Balancer / GitLab Project ͷ࡞੒ΛAPIΛ௨ͯࣗ͡ಈԽ •  Management

    ConsoleΛఏڙ͠KubernetesΛந৅Խ •  GitLab CIͱ࿈ܞ͠CI/CDΛ࣮ݱ •  ӡ༻͸Gitૢ࡞Ͱ׬݁ͤ͞ಛผͳૢ࡞͸ෆཁ ୭Ͱ΋؆୯ʹ࢖͑ΔϓϥοτϑΥʔϜͱͯ͠KubernetesΛ׆༻