From Event to Action: Accelerate Your Decision Making with Real-Time Automation
2018 03-14-adam devops-developing-on-kubernetes
1. Developing on Kubernetes
Michael Hausenblas @mhausenblas
Developer Advocate, Red Hat
2018-03-14, DevOps Amsterdam, Amsterdam Schiphol
2. Hit me up on Twitter: @mhausenblas
2
• Developer Advocate @ Red Hat (Go, Kubernetes, OpenShift)
• Developer Advocate @ Mesosphere
• Chief Data Engineer @ MapR
• Applied research (IE/AT)
• Nowadays mainly Go (Python, Node, Java, C++)
• Dev turned ops
$ whois mhausenblas
3. Hit me up on Twitter: @mhausenblas
3
admin
SRE
developer
QA
architect
PM
PHB
9. Hit me up on Twitter: @mhausenblas
9
• 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 …
11. Hit me up on Twitter: @mhausenblas
11
Containers 101
containerz.info
… a process group on steroids using namespaces, cgroups, and a copy-on-write filesystem
12. Hit me up on Twitter: @mhausenblas
12
Container orchestration
13. Hit me up on Twitter: @mhausenblas
13
Container orchestration
kubernetes.io
• Container lifecycle management
• Declarative, state-driven
• Extensible, modular API
• Robust, flexible, scalable
15. Hit me up on Twitter: @mhausenblas
15
Status quo
build artefacts build tooling runtime
config
code
creds
CI/CD pipeline
||||
code repo binary
bare metal server/VMs
16. Hit me up on Twitter: @mhausenblas
16
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
17. Hit me up on Twitter: @mhausenblas
17
Development setups (conceptually)
remote
local
cluster
dev
cluster
dev
cluster
dev
dev
cluster
pure off-line proxied live pure on-line
18. Hit me up on Twitter: @mhausenblas
18
Tooling
www.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
19. Hit me up on Twitter: @mhausenblas
19
Example 1: all local/not containerized
• Each service developed locally (e.g.,
on your laptop)
• Natively, that is, in a non-
containerized manner
20. Hit me up on Twitter: @mhausenblas
20
Example 1: all local/not containerized
• Pros
• continue to work as you “always did”
• high development velocity
• Cons
• dependency hell
• dev/prod imparity
21. Hit me up on Twitter: @mhausenblas
21
Example 2: all local/containerized
• Each service developed locally (e.g.,
on your laptop)
• One container image per service,
locally managed (build, run, etc.)
22. Hit me up on Twitter: @mhausenblas
22
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
23. Hit me up on Twitter: @mhausenblas
23
Example 3: mixed local/cluster
• “Your” service developed locally
(containerized or not)
• Other service(s) run in the cluster
24. Hit me up on Twitter: @mhausenblas
24
Example 3: mixed local/cluster
• Pros
• almost full dev/ops parity
• Cons
• requires tooling (proxy, CI/CD)
• Neutral
• development velocity depends on tooling
25. Hit me up on Twitter: @mhausenblas
25
Example 4: all in-cluster
• “Your” service developed locally and
container image is pushed to
cluster (registry)
• All services run in the cluster
26. Hit me up on Twitter: @mhausenblas
26
Example 4: all in-cluster
• Pros
• full dev/ops parity
• scalability (testing!)
• Cons
• development velocity sucks
27. Hit me up on Twitter: @mhausenblas
27
Which development setup should I choose?
31. Hit me up on Twitter: @mhausenblas
31
Articles and related resources (1)
• What should be proper (local) development workflow?—Kubernetes Issue #43665
• https://abhishek-tiwari.com/local-development-environment-for-kubernetes-using-minikube/
• https://dzone.com/articles/a-development-workflow-for-kubernetes-services
• http://blog.jonparrott.com/building-a-paas-on-kubernetes/
• https://kubecloud.io/minikube-workflows-d7166e1da290
• https://developer.atlassian.com/blog/2017/07/kubernetes-workflow/
• https://blog.codersociety.com/node-js-development-workflow-for-kubernetes-part-1-c05e3771d40a
32. Hit me up on Twitter: @mhausenblas
32
Articles and related resources (2)
• https://stackoverflow.com/questions/29746926/how-to-do-local-development-with-kubernetes
• https://kubernetes.io/docs/user-journeys/users/application-developer/intermediate/
• Declarative application management in Kubernetes by Brian Grant (09/2017)
• https://docs.microsoft.com/en-us/azure/container-service/kubernetes/container-service-draft-up
• https://thenewstack.io/microsoft-launches-brigade-event-driven-scripting-tool-kubernetes/
• https://blog.openshift.com/live-code-updates-using-webdav/
• HN discussion on Google Skaffold – Easy and Repeatable Kubernetes Development