Continuous Delivery with Concourse and Kubernetes

9f9df80ab6551776b49c4ad9432ba1b7?s=47 Kazuki Suda
November 14, 2017

Continuous Delivery with Concourse and Kubernetes

9f9df80ab6551776b49c4ad9432ba1b7?s=128

Kazuki Suda

November 14, 2017
Tweet

Transcript

  1. Concourse CI/CD Meetup Tokyo #7 2017/11/14 Kazuki Suda <ksuda@zlab.co.jp> @superbrothers

    Continuous Delivery with Concourse and Kubernetes
  2.  Kazuki Suda / @superbrothers ▶ Software Engineer@Z Lab ▶

    One of the organizers of Kubernetes Meetup Tokyo
  3. Agenda 1. What is Kubernetes? 2. How to deploy your

    application to Kubernetes? 3. Continuous Delivery with Concourse and Kubernetes 3
  4. What is Kubernetes?

  5. Kubernetes ▶ Container orchestrator ▶ Configure, deploy and manage containers

    ▶ κυβερνήτης: Geek for “Helmsman” ▶ Manage applications, not machines 5 “Kubernetes is open source—a contrast to Borg and Omega,
 which were developed as purely Google-internal systems. “ Borg, Omega, and Kubernetes
 https://research.google.com/pubs/pub44843.html
  6. Compare with other platforms 6 ▶ Infrastructure as a Service

    ▶ VM, Disk, Network Kubernetes ▶ Container as a Service ▶ Run and manage containers ▶ Every application Cloud Foundry ▶ Platform as a Service ▶ Deploy apps from code ▶ HTTPɺAPIɺWeb OpenStack
  7. Kubernetes: Up & Running

  8. How to deploy your application to Kubernetes?

  9. How to deploy your application to Kubernetes? kubectl: CLI for

    controlling the Kubernetes cluster ▶ run: Run a particular container image on the cluster ▶ create: Create resources ▶ delete: Delete resources ▶ apply: Apply a configuration to resources ▶ get: Display one or many objects 9
  10. Imperative command ▶ The simplest way to run a one-off

    task in a cluster # Start a replicated container of nginx $ kubectl run myapp —image=nginx:latest —replicas=5 10
  11. Imperative object configuration ▶ Create, update and delete Kubernetes objects

    by using kubectl along with manifest files written in YAML or JSON # Create a resource by a manifest file $ kubectl create -f nginx-deployment.yaml 11
  12. Declarative object configuration ▶ Use kubectl apply to create and

    update objects as needed # Create/Update a resource by a manifest file $ kubectl apply -f nginx-deployment.yaml 12
  13. Management techniques 13 Kubernetes Object Management Management technique Operates on

    Recommended environment Imperative commands Live objects Development projects Imperative object configuration Individual files Production projects Declarative object configuration Directories of files Production projects
  14. Continuous Delivery with Concourse and Kubernetes

  15. 

  16. Versions Providing multiple versions which corresponds to the version of

    kubectl. ▶ zlabjp/kubernetes-resource:1.8 ▶ zlabjp/kubernetes-resource:1.7 ▶ zlabjp/kubernetes-resource:1.6 16
  17. Source configuration ▶ kubeconfig + kubeconfig: A kubeconfig file kubeconfig:

    | apiVersion: v1 clusters: - cluster: ... 17
  18. How to create a kubeconfig file? 18 https://github.com/zlabjp/kubernetes-scripts ▶ create-kubeconfig

    <serviceaccount-name> <options> + This script allows you to easily create a kubeconfig file to access the apiserver with the specified serviceaccount.
  19. Source configuration ▶ Cluster options + server: The address and

    port of the API server + token: Bearer token for authentication + namespace: The namespace scope + certificate_authority: A certificate file + insecure_skip_tls_verify: If true, the API server's certificate will not be checked for validity 19
  20. Behaviour ▶ check: Do nothing ▶ in: Do nothing ▶

    out: Control the Kubernetes cluster + Control the Kubernetes cluster like kubectl apply, kubectl delete, kubectl label and so on. 20
  21. out parameters ▶ kubectl (Requried) + Specify the operation that

    you want to perform on one or more resources, for example apply, delete, label. ▶ wait_until_ready (Optional) + The number of seconds that waits until all pods are ready. 0 means don't wait. Defaults to 30. 21
  22. out parameters ▶ wait_until_ready_interval (Optional) + The interval (sec) on

    which to check whether all pods are ready. Defaults to 3. ▶ wait_until_ready_selector (Optional) + A label selector to identify a set of pods which to check whether those are ready. Defaults to every pods in the namespace. 22
  23.  resource_types: - name: kubernetes type: docker-image source: repository: zlabjp/kubernetes-resource

    tag: "1.8" resources: - name: prod type: kubernetes source: kubeconfig: ((prod-kubeconfig)) - name: repo type: git source: ... jobs: - name: prod-deploy plan: - get: repo trigger: true - put: prod params: kubectl: apply -f repo/deploy -f repo/deploy/prod wait_until_ready_selector: app=myapp
  24.  https://github.com/zlabjp/concourse-meetup-tokyo-7-demo

  25. Please feel free to contribute! ▶ https://github.com/zlabjp/kubernetes-resource/issues 25

  26. Thanks! ▶ Slide + bit.ly/concourse-and-k8s ▶ Questions? + Kazuki Suda

    <ksuda@zlab.co.jp> + @superbrothers