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

Kubernetes in Docker - Killing Bugs with KINDness

Kubernetes in Docker - Killing Bugs with KINDness

Abstract: KIND - Kubernetes IN Docker - is a relatively new tool for running Kubernetes clusters within Docker. KIND enables engineers to spin up local development cluster in under a minute, utilising Docker containers as "nodes". KIND was originally born as a method of running conformance tests for the Kubernetes project itself, and has quickly gained in popularity within the community thanks to its fast startup time, ease of use, and growing feature set. In this talk I will briefly look at how KIND differs from other local cluster tools, discuss a range of possible use-cases for KIND - both for local development and within CI/CD pipelines, and finally demonstrate how you can get starting using KIND.

Josh Michielsen

July 25, 2019
Tweet

More Decks by Josh Michielsen

Other Decks in Programming

Transcript

  1. Killing Bugs with KINDness
    Introduction to Kubernetes in Docker (KIND)
    By Josh Michielsen
    Senior Software Engineer
    Condé Nast International (@condenasteng)
    1

    View Slide

  2. About Me
    Senior Software Engineer
    Australian
    Cyclist
    Photographer
    Dog Lover
    @jmickey_
    jmichielsen
    jmickey
    mickey.dev
    [email protected]
    2

    View Slide

  3. 3

    View Slide

  4. What is KIND?
    kind is a tool for running local
    Kubernetes clusters using Docker
    container "nodes".
    - https://kind.sigs.k8s.io/
    4

    View Slide

  5. KIND Architecture
    5
    via https://kind.sigs.k8s.io/docs/design/initial

    View Slide

  6. Why KIND?
    6
    1
    Rapid startup time (~30 sec)
    2
    Supports multi-node HA clusters
    3
    Supports Windows, macOS, and Linux
    4
    CNCF certified conformant
    5
    Exposes the Kubeadm config surface

    View Slide

  7. Installing KIND
    1
    Via Go
    GO111MODULE=”on” go get sigs.k8s.io/[email protected]
    2
    Via Docker (from source)
    git clone https://github.com/kubernetes-sigs/kind.git
    make build
    3
    Via Pre-Compiled Binaries
    Download from https://github.com/kubernetes-sigs/kind/releases
    Copy to $PATH
    7

    View Slide

  8. 8
    kind create cluster

    View Slide

  9. 9
    Launch Specific Kubernetes Version
    kind create cluster --image kindest/node:v1.13.7
    Additional Clusters
    kind create cluster --name cluster-2
    Pass Config
    kind create cluster --config
    Retrieve KubeConfig & Set $KUBECONFIG
    kind get kubeconfig
    export KUBECONFIG="$(kind get kubeconfig-path)"
    Sideload Docker Image
    kind load docker-image hello-world
    Sideload Docker Archive
    kind load image-archive archive.tar.gz

    View Slide

  10. 10
    KIND has its own configuration API which
    can be used to describe the desired state of a
    cluster. Such as:
    - Nodes
    - Port Mappings
    - Networking
    KIND also exposes the Kubeadm
    configuration surface through config patch
    structs.
    Configuration

    View Slide

  11. 11
    HA Cluster Additional Port Mappings
    Use with NodePort services to allow ingress to applications.

    View Slide

  12. 12
    Kubeadm Patch

    View Slide

  13. 13
    Use Cases
    1
    Local Development.
    Caveats: No Load Balancer or ClusterIP
    support. Limited use case for testing ingress
    services.
    2
    CI: Helm Charts Validation
    Test that changes to helm charts within CI
    to ensure all services are deployed
    correctly.
    3
    Cluster Config
    Sanity check cluster config changes, e.g. Pod
    Affinity/Anti-Affinity.
    4
    Pre-merge Ephemerial Deployments
    Testing application changes in short-lived
    environments. A common use case within
    the Kubernetes team is testing Operators.

    View Slide

  14. KIND in CI
    KIND has been tested, and is working, within a
    number of popular CI systems, including: CircleCI,
    TravisCI, GitLab, Concourse, Azure Pipelines, and
    Drone.
    A repo of example configurations for various CI
    systems is maintained here:
    https://github.com/kind-ci/examples
    14

    View Slide

  15. Comparison to Alternatives
    15
    Minikube
    ● Either requires a Hypervisor, or will create
    a container for each control plane
    component.
    ● Not CI friendly.
    ● Much slower to start.
    Docker Desktop Kubernetes
    ● Slow to install.
    ● Single node cluster, no HA support.
    ● Not CI friendly.
    ● More resource intensive.

    View Slide

  16. Additional Features
    16
    Mount host machine filesystem paths
    Customise networking
    Customisable listenAddress and API ports

    View Slide

  17. 17
    @jmickey_
    jmichielsen
    jmickey
    mickey.dev
    [email protected]
    Thanks for listening!

    View Slide