Share
Embed
Developing Kubernetes apps
CNCF Ireland talk, see https://www.meetup.com/Cloud-Native-Ireland/events/248089561/
Michael Hausenblas
April 10, 2018
Transcript
33 slides
-
Developing apps on Kubernetes Michael Hausenblas @mhausenblas Developer Advocate, Red
Hat 2018-10-04, Cloud Native Ireland & Docker Dublin -
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 -
Hit me up on Twitter: @mhausenblas 3 admin SRE developer
QA architect PM PHB -
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 stock-gen stock-con -
Hit me up on Twitter: @mhausenblas 6 stock-gen :9876/stockdata stock-con
:9898/average/NYSE:RHT -
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 -
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 -
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 … -
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 -
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 github.com/MinikubeAddon/watchpod -
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 -
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 -
Hit me up on Twitter: @mhausenblas 17 Source-to-Image (S2I) •
A build-based tool and workflow • Local (Minishift) or live (OpenShift Online) • Mature, battle tested solution • See docs for details -
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 -
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) -
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 -
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 -
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.) -
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 -
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 -
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 -
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 -
Hit me up on Twitter: @mhausenblas 28 Example 4: all
in-cluster • Pros • full dev/ops parity • scalability (testing!) • Cons • development velocity sucks -
Hit me up on Twitter: @mhausenblas 29 • Prototyping/testing of
microservices: • Minikube/Minishift with ksync/Telepresence/local build setup • S2I with internal registry • Watchpod, freshpod, gitkube • Team-level/integration: • Skaffold, draft.sh • S2I with Jenkins pipeline and external registry Recommendations -
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