Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Creating a fast Kubernetes Development Workflow
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Bastian Hofmann
May 26, 2019
Programming
280
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
380
Creating a fast Kubernetes Development Workflow
bastianhofmann
0
150
Highly available cross-region deployments with Kubernetes
bastianhofmann
1
180
From source to Kubernetes in 30 minutes
bastianhofmann
0
200
Introduction to Kubernetes
bastianhofmann
1
140
CI/CD with Kubernetes
bastianhofmann
0
250
Creating a fast Kubernetes Development Workflow
bastianhofmann
1
290
Deploying your first Micro-Service application to Kubernetes
bastianhofmann
2
220
Dive-In-Workshop: Kubernetes
bastianhofmann
0
460
Other Decks in Programming
See All in Programming
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
2
300
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
190
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
190
Heart of Swift Concurrency
koher
0
960
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
120
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
300
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
170
一人だけ、Kiroが静止する日
hideg
0
130
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
240
wkhtmltopdfの次どうするか問題2026
willnet
2
1.6k
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
510
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
570
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
500
How to build a perfect <img>
jonoalderson
1
6k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
410
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
480
A designer walks into a library…
pauljervisheath
211
25k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
290
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
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