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

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. 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
  2. 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
  3. 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
  4. 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
  5. 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 …
  6. 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
  7. 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
  8. 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
  9. 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

  10. 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
  11. 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

  12. 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)
  13. 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
  14. 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
  15. 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.)
  16. 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
  17. 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
  18. 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
  19. 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
  20. Hit me up on Twitter: @mhausenblas 28 Example 4: all

    in-cluster • Pros • full dev/ops parity • scalability (testing!) • Cons • development velocity sucks
  21. 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
  22. 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