$30 off During Our Annual Pro Sale. View Details »

Developing apps on Kubernetes

Developing apps on Kubernetes

Michael Hausenblas

April 04, 2018
Tweet

More Decks by Michael Hausenblas

Other Decks in Technology

Transcript

  1. Developing apps on Kubernetes
    Michael Hausenblas @mhausenblas

    Developer Advocate, Red Hat

    2018-04-04, CNCF Paris

    View Slide

  2. Hit me up on Twitter: @mhausenblas
    2
    • Developer Advocate @ Red Hat (Go, Kubernetes, OpenShift)
    • Developer Advocate @ Mesosphere (Mesos, DC/OS, Kubernetes)
    • Chief Data Engineer @ MapR (HDFS, HBase, Drill, etc.)
    • Applied research (4y in Ireland, 7y in Austria)
    • Nowadays mainly developing tools in Go (Python, Node, Java, C++)
    • Kinda developer turned ops (aka appops)
    $ whois mhausenblas

    View Slide

  3. Hit me up on Twitter: @mhausenblas
    3
    admin
    SRE
    developer
    QA
    architect
    PM
    PHB

    View Slide

  4. … demo time!
    301.sh/2018-dok-cncfparis

    View Slide

  5. Hit me up on Twitter: @mhausenblas
    5
    Demo example: a minimal µS-based app
    • App consists of two microservices:
    • a stock generator written in Go
    • a stock consumer written in Node.js
    • Source code of demo app:

    github.com/kubernauts/dok-example-us
    • Demo script:

    301.sh/2018-dok-cncfparis
    stock-gen
    stock-con

    View Slide

  6. Hit me up on Twitter: @mhausenblas
    6
    stock-gen
    :9876/stockdata
    stock-con
    :9898/average/NYSE:RHT

    View Slide

  7. Building and delivering apps on Kubernetes

    View Slide

  8. Hit me up on Twitter: @mhausenblas
    8
    Build and delivery status quo
    build artefacts build tooling runtime
    config
    code
    creds
    CI/CD pipeline
    ||||
    code repo binary
    bare metal server/VMs

    View Slide

  9. Hit me up on Twitter: @mhausenblas
    9
    Doing it the cloud native way
    build artefacts build tooling runtime
    CI/CD pipeline
    ||||
    code repo container
    container orchestrator +

    service mesh
    config
    code creds
    container
    image
    manifest
    container
    runtime
    manifest
    service
    mesh
    manifest
    container

    registry

    View Slide

  10. Development modes

    View Slide

  11. Hit me up on Twitter: @mhausenblas
    11
    • You are part of a devops team, developing three µS
    that in turn depend on five µS outside of your control
    • Have Node.js/Java/Python and Kubernetes cluster 

    as target runtime environment
    • Want ✓ high development velocity

    ✓ dev/ops parity
    An example brief …

    View Slide

  12. Hit me up on Twitter: @mhausenblas
    12
    Development modes (conceptually)
    remote
    local
    cluster
    dev
    cluster
    dev
    cluster
    dev
    dev
    cluster
    pure off-line proxied live pure on-line

    View Slide

  13. Tooling

    View Slide

  14. Hit me up on Twitter: @mhausenblas
    14
    telepresence.io
    vapor-ware.github.io/ksync/
    www.openshift.org
    kubed.sh
    kedgeproject.org
    ksonnet.io
    Minikube
    Minishift
    Docker Community Edition for Mac & Windows
    github.com/GoogleCloudPlatform/skaffold
    draft.sh
    forge.sh
    gitkube.sh
    github.com/weaveworks/flux

    View Slide

  15. Hit me up on Twitter: @mhausenblas
    15
    Minikube
    • Different modes possible, for example:
    • Using standard CI/CD pipeline like Jenkins with any
    registry (for example Quay) for online development
    • Local builds via eval $(minikube docker-env)
    • Community-driven, part of Kubernetes proper
    • See docs for details

    View Slide

  16. Hit me up on Twitter: @mhausenblas
    16
    ksync
    vapor-ware.github.io/ksync/
    • A file sync-based tool, leveraging syncthing.net
    • Local and/or live setups possible
    • Super easy and fast, requires cluster-side process via
    daemon set (permissions)
    • Try it out via Katacoda for free, in your browser


    View Slide

  17. Hit me up on Twitter: @mhausenblas
    17
    Source-to-Image (S2I)
    • A build-based tool and workflow
    • Local (Minishift) or live (OpenShift Online)
    • Battle proof solution, by Red Hat
    • See docs for details

    View Slide

  18. Hit me up on Twitter: @mhausenblas
    18
    Skaffold
    github.com/GoogleCloudPlatform/skaffold
    • A build-based tool and workflow
    • Local and GKE
    • Relatively new, by Google Cloud
    • See intro blog post for details


    View Slide

  19. Hit me up on Twitter: @mhausenblas
    19
    Telepresence
    www.telepresence.io
    • A proxy-based tool
    • Local and live setups possible
    • Mature but requires cluster-side process (permissions)
    • By Datawire (have also forge.sh)

    View Slide

  20. Workflows by example

    View Slide

  21. Hit me up on Twitter: @mhausenblas
    21
    Example 1: all local/not containerized
    • Each service developed locally (e.g.,
    on your laptop)
    • Natively, that is, in a non-
    containerized manner

    View Slide

  22. Hit me up on Twitter: @mhausenblas
    22
    Example 1: all local/not containerized
    • Pros
    • continue to work as you “always did”
    • high development velocity
    • Cons
    • dependency hell
    • dev/prod imparity

    View Slide

  23. Hit me up on Twitter: @mhausenblas
    23
    Example 2: all local/containerized
    • Each service developed locally (e.g.,
    on your laptop)
    • One container image per service,
    locally managed (build, run, etc.)

    View Slide

  24. Hit me up on Twitter: @mhausenblas
    24
    Example 2: all local/containerized
    • Pros
    • minimal overhead, can learn in hours
    • no dependency hell
    • high development velocity
    • Cons
    • still not full dev/ops parity

    View Slide

  25. Hit me up on Twitter: @mhausenblas
    25
    Example 3: mixed local/cluster
    • “Your” service developed locally
    (containerized or not)
    • Other service(s) run in the cluster

    View Slide

  26. Hit me up on Twitter: @mhausenblas
    26
    Example 3: mixed local/cluster
    • Pros
    • almost full dev/ops parity
    • Cons
    • requires tooling (proxy, CI/CD)
    • Neutral
    • development velocity depends on tooling

    View Slide

  27. Hit me up on Twitter: @mhausenblas
    27
    Example 4: all in-cluster
    • “Your” service developed locally and
    container image is pushed to
    cluster (registry)
    • All services run in the cluster

    View Slide

  28. Hit me up on Twitter: @mhausenblas
    28
    Example 4: all in-cluster
    • Pros
    • full dev/ops parity
    • scalability (testing!)
    • Cons
    • development velocity sucks

    View Slide

  29. Hit me up on Twitter: @mhausenblas
    29
    • Prototyping/testing of microservices:
    • Minikube with ksync/Telepresence
    • Minikube with local build setup
    • forge.sh, gitkube
    • Team-level/integration:
    • Skaffold, draft.sh
    • S2I with internal registry or Jenkins pipeline with external registry
    Recommendations

    View Slide

  30. Resources

    View Slide

  31. Hit me up on Twitter: @mhausenblas
    31

    View Slide

  32. Hit me up on Twitter: @mhausenblas
    32
    • Local Development Environment for Kubernetes using Minikube

    https://abhishek-tiwari.com/local-development-environment-for-kubernetes-using-minikube/
    • TGI Kubernetes 029: Developing Apps with Ksync

    https://www.youtube.com/watch?v=QW85Y0Ug3KY
    • TGI Kubernetes 030: Exploring Skaffold

    https://www.youtube.com/watch?v=McwwWhCXMxc
    • Using Telepresence for Kubernetes Development

    https://www.youtube.com/watch?v=G8fA_JssUG8
    • Git based application deployment patterns for Kubernetes

    https://docs.google.com/presentation/d/1d3PigRVt_m5rO89Ob2XZ16bW8lRSkHHH5k816-oMzZo/
    • Draft vs Gitkube vs Helm vs Ksonnet vs Metaparticle vs Skaffold

    https://blog.hasura.io/draft-vs-gitkube-vs-helm-vs-ksonnet-vs-metaparticle-vs-skaffold-f5aa9561f948 


    View Slide

  33. plus.google.com/+RedHat
    linkedin.com/company/red-hat
    youtube.com/user/RedHatVideos
    facebook.com/redhatinc
    twitter.com/RedHatNews
    learn.openshift.com

    View Slide