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

Compose on Kubernetes

Compose on Kubernetes

Introduction to Compose on Kubernetes for Docker Tokyo #27

Kunal Kushwaha

January 16, 2019
Tweet

More Decks by Kunal Kushwaha

Other Decks in Technology

Transcript

  1. Compose on Kubernetes
    Kunal Kushwaha
    @kunalkushwaha
    NTT OSSC

    View Slide

  2. What is compose?

    View Slide

  3. ● Compose is a tool for defining and running multi-container Docker applications.
    ● Services and dependencies are defined in YAML file to configure application.
    ● Using single command, you create and start all the services from your
    configuration.
    ● Also works with swarm.
    ● Tool for developers.
    https://docs.docker.com/compose/ Diagram Credit : cloudacademy

    View Slide

  4. Why compose?

    View Slide

  5. ● Provides the flexibility to use a project name to isolate the environments from
    each other
    ● Compose preserves all volumes used by the services defined in the compose
    file, thus no data is lost when the containers are recreated
    ● Containers which have changed are recreated, the containers whose state did
    not change remain untouched
    ● Support for variables in the compose file, we can define variables in a .env file
    and use them in the docker-compose file
    https://docs.docker.com/compose/

    View Slide

  6. $ docker-compose up -d
    $ docker-compose down
    $ docker-compose start
    $ docker-compose stop
    $ docker-compose build
    $ docker-compose logs -f
    $ docker-compose scale =4
    $ docker-compose events
    $ docker-compose exec bash
    Docker compose commands

    View Slide

  7. Why Compose on Kubernetes?

    View Slide

  8. ● The Kubernetes API is amazingly general
    purpose – it exposes low-level primitives for
    building the full range of distributed systems.

    ● There are more than 50 first-class objects in
    the latest release, from Pods and
    Deployments to
    ValidatingWebhookConfiguration and
    ResourceQuota etc

    ● This can lead to a verbosity in configuration,
    which then needs to be managed by you,
    the developer.
    kubernetes APIs Compose on Kubernetes
    ● Compose meanwhile isn’t an API but a
    high-level tool focused on developer
    productivity
    ● For the common case of a set of
    interconnected web services, Compose
    provides an abstraction that simplifies
    Kubernetes configuration
    ● For everything else you can still drop down
    to the raw Kubernetes API primitives

    View Slide

  9. Architecture & Implementation

    View Slide

  10. - Adds ‘stack’ object by extending kubernetes using API Aggregation.
    - As ‘stack’ object is native, can be integrated with other k8s tools like skaffold.

    View Slide

  11. Efficiency of Compose?

    View Slide

  12. $ git clone https://github.com/microservices-demo/microservices-demo.git
    $ cd deployment/kubernetes/manifests
    $ (Get-ChildItem -Recurse -File | Get-Content | Measure-Object -line).Lines
    908
    $ cd ../../docker-compose
    $ (Get-Content docker-compose.yml | Measure-Object -line).Lines
    174
    More than 5x code is reduced in compose as compared to raw k8s object description

    View Slide

  13. Docker Desktop (Windows/Mac)
    ● Installed by default.
    Deploying Compose on Kubernetes
    ● Guide for Azure AKS.
    ● Guide for GKE
    ● Guide for Minikube.
    Try compose-on-kubernetes !

    View Slide

  14. Demo

    View Slide

  15. Thanks
    ありがとう

    View Slide