Slide 1

Slide 1 text

Developing apps on Kubernetes Michael Hausenblas @mhausenblas
 Developer Advocate, Red Hat
 2018-04-04, CNCF Paris

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

Building and delivering apps on Kubernetes

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

Development modes

Slide 11

Slide 11 text

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 …

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

Tooling

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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


Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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


Slide 19

Slide 19 text

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)

Slide 20

Slide 20 text

Workflows by example

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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.)

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

Resources

Slide 31

Slide 31 text

Hit me up on Twitter: @mhausenblas 31

Slide 32

Slide 32 text

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 


Slide 33

Slide 33 text

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