Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Creating a fast Kubernetes Development Workflow
Search
Bastian Hofmann
May 26, 2019
Programming
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Creating a fast Kubernetes Development Workflow
Bastian Hofmann
May 26, 2019
More Decks by Bastian Hofmann
See All by Bastian Hofmann
Monitoring in Kubernetes with Prometheus and Grafana
bastianhofmann
0
360
Creating a fast Kubernetes Development Workflow
bastianhofmann
0
150
Highly available cross-region deployments with Kubernetes
bastianhofmann
1
170
From source to Kubernetes in 30 minutes
bastianhofmann
0
190
Introduction to Kubernetes
bastianhofmann
1
140
CI/CD with Kubernetes
bastianhofmann
0
240
Creating a fast Kubernetes Development Workflow
bastianhofmann
1
280
Deploying your first Micro-Service application to Kubernetes
bastianhofmann
2
200
Dive-In-Workshop: Kubernetes
bastianhofmann
0
450
Other Decks in Programming
See All in Programming
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.6k
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
490
Claspは野良GASの夢をみるか
takter00
0
180
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
150
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4k
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
120
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
740
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
490
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
320
net-httpのHTTP/2対応について
naruse
0
470
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
220
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
1
640
Featured
See All Featured
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
580
BBQ
matthewcrist
89
10k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
Documentation Writing (for coders)
carmenintech
77
5.4k
How to build a perfect <img>
jonoalderson
1
5.6k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
420
How to Talk to Developers About Accessibility
jct
2
230
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
720
Amusing Abliteration
ianozsvald
1
200
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Transcript
@BastianHofmann Creating a fast Kubernetes Development Workflow Bastian Hofmann
None
Container orchestration platform
Deploy, run and scale your services in isolated containers
Very Powerful
Large community
Lot’s of large company backers
No vendor lock in
Standardized APIs
Runs on
Your laptop
None
Bare metal
Cloud Providers
AWS
Azure
Google Cloud Platform
And if you don't want to install and maintain Kubernetes
yourself
Managed Kubernetes
None
Easy setup
Easy upgrades
Easy scaling
Features
Load Balancing
Distributed Persistent Storage
Backups
Monitoring
Support
You can focus on what is important
But this talk is about how to use Kubernetes
Not only for production workloads
But in your development workflows
Kubernetes has standardized apis
More and more integrations
Great tools
Agenda
Introduction to Kubernetes
Deployment of a simple application
Deployment of a micro-service application
Some tools for development with Kubernetes
But first
Why containers?
Services run in isolation
Everything needed to run a service in one image
Make things …
Easier to develop
Easier to deploy
Easier to upgrade system dependencies
Easier to scale
Better resource usage
#safeThePlanet
Kubernetes helps you to deploy, run and scale containers
Let’s define some core concepts and terminology first
Kubernetes Cluster
• A docker image built from a Dockerfile that contains
everything a service needs to run Image
• A container runs a docker image. • Only 1
process can run inside of a container Container
• A group of 1 or more containers • Same
port space • Within a Pod: communication over localhost • Every Pod has it's own IP • All Pods can talk with each other • IPs change all the time Pod
• Defines and manages how many instances of a pod
should run • ReplicaSet is tied to a specific definition of a Pod which is tied to specific image versions of the container • Image versions in ReplicaSets can't be updated Replica Set
• Manages updates and rollbacks of replica sets Deployment
• Internal LoadBalancer • Makes all pods matching a set
of labels accessible through a stable, internal IP address • You can attach external IP address through an cloud LoadBalancer Service
• Makes a service accessible to the outside of Kubernetes
through an ingress controller (e.g. nginx) • Traffic is routed by routing rules, usually Host header Ingress
• A physical server • Containers get distributed automatically Node
• Key/Value storage for configuration ConfigMap
• Key/Value storage for configuration, usually passwords. Secret
• Volumes can be mounted into a container to access
a ConfigMap, Secret, persistent volumes with network storage or a folder on the node Volumes
• Dedicated environment to deploy services in Namespaces
CronJobs, DaemonSets, StatefulSets, ...
Everything is a resource
You interact with Kubernetes by creating, receiving, updating and deleting
resources
Kubernetes has controllers to listen on these interactions and get
the cluster in the desired state
The Kubernetes API can be extended with additional Resources and
Controllers
CustomResourceDefinitions
Certificate, Backup, Restore, MySQLCluster, Function, ...
kind: Deployment apiVersion: extensions/v1beta1 metadata: name: symfony-demo spec: template: spec:
containers: - name: symfony-demo image: symfony-demo:1.1.0 ports: - containerPort: 80
$ kubectl apply -f deployment.yaml
$ kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
symfony-demo 1 1 1 1 21h
$ kubectl get deployment symfony-demo -o yaml apiVersion: extensions/v1beta1 kind:
Deployment metadata: annotations: ... spec: ... template: ... spec: containers: - name: symfony-demo image: symfony-demo:1.1.0
$ kubectl delete deployment symfony-demo
Practical example
We need a cluster
Let’s deploy an application
DEMO
What did just happen?
None
Deployment created
Sees new Deployment And creates new ReplicaSet with 1 desired
replica
Sees new ReplicaSet and Creates Pod for ReplicaSet
Sees new unscheduled Pod and Schedules it to Node
Sees it is supposed to start a Pod And starts
its Containers
Service created
Sees the new Service And configures IP Table Rules and
DNS entries
Sees the new Service has the Type LoadBalancer and creates
An External LB at the Cloud Provider
What about Configuration
DEMO
What about TLS and DNS
You don't want to implement TLS certificate handling in every
public service
Ingress Controller and cert-manager
The ingress controller (nginx) listens on Ingress Resources and configures
itself to route incoming traffic based on the host header to the correct running pods
Cert-manager listens on Ingresses and if they want TLS, requests
a certificate from LetsEncrypt
External-DNS listens on Ingresses and creates DNS entries at DigitalOcean
How is traffic routed to the Pod
OpenStack LoadBalancer
DEMO
What about Persistent Storage and Databases
DEMO
Writing this YAML files is tedious
YAML files are tied to a specific version and a
specific environment
Production
Staging
Development
Per Development team
Per branch
Per developer
Built-in
Namespaces
Still we'd need to maintain multiple very similar YAML files
with slightly different versions and configuration.
"Templating"
Great tools because of standardized Kubernetes API
Helm
None
Allows to install applications
So called "charts"
Writing your own charts if fairly easy
Charts can depend on other charts
Multiple deployments of one chart possible
Different namespaces
Different release names
Configuration over values
None
Different versions
Different ingress urls
$ helm install stable/wordpress --namespace bastian --name my-wordpress --values dev.yaml
--values bastian.yaml
Still:
Make a code change
Build docker image
Push docker image
Run helm install/upgrade with new image version
Can this be quicker?
Tilt
Watches for changes
Rebuilds docker image
Deploys to Kubernetes
You can use your helm templates
$ tilt up
Demo application
web quote-svc hello-svc
Not all services have an ingress
Accessing Kubernetes from the outside
web quote-svc hello-svc
Getting a shell in a running container
$ kubectl exec $POD_NAME -i -t -- /bin/bash
Port forwarding through kubectl
$ kubectl port-forward pod/$POD_NAME 8080:80
$ kubectl port-forward service/$SERVICE_NAME 8080:80
What about step debugging?
Of course you can run everything locally
But you develop only on one service
There may be lots of services
You don't want to expose all services publicly
Port-forwarding all services is also work
Telepresence
None
Creates a two-way proxy between the Kubernetes cluster and you
$ telepresence T: Starting proxy with method 'vpn-tcp'... @fhgbvx65xg|bash-3.2$ curl
http://quote-svc/quote | jq '.' [ { "ID": 503, "title": "stefan sagmeister", "content": "<p>...</p>\n", "link": "https://quotesondesign.com/stefan- sagmeister-2/" } ]
Swap a running deployment in the cluster with a local
process
... or a locally running docker container
$ telepresence --swap-deployment quote-svc --namespace dev-flow-demo --expose 3000 --run npm
run debug T: Starting proxy with method 'vpn-tcp',... T: Forwarding remote port 3000 to local port 3000.... >
[email protected]
debug /Users/bhofmann/forge_test/quote- svc > nodemon --inspect quote-svc.js [nodemon] watching: *.* [nodemon] starting `node --inspect quote-svc.js` Debugger listening on ws://127.0.0.1:9229/83aa27ac- d879-4b50-a228-440354cca791 quote svc listening on port 3000!
Demo
Summary
Powerful
Helpful
Great tooling because of common APIs
Especially great if you have multiple services and don't want
to run everything locally
I just picked helm, tilt and telepresence. There is more
for different use-cases.
http:/ /speakerdeck.com/ u/bastianhofmann
https:/ /github.com/bashofmann/ kubernetes-dev-flow-demo
[email protected]
https:/ /twitter.com/BastianHofmann