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

Continuous Delivery with Concourse and Kubernetes

Kazuki Suda
November 14, 2017

Continuous Delivery with Concourse and Kubernetes

Kazuki Suda

November 14, 2017
Tweet

More Decks by Kazuki Suda

Other Decks in Technology

Transcript

  1.  Kazuki Suda / @superbrothers ▶ Software Engineer@Z Lab ▶

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

    application to Kubernetes? 3. Continuous Delivery with Concourse and Kubernetes 3
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 

  11. 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
  12. 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.
  13. 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
  14. 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
  15. 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
  16. 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
  17.  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