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
Stateful Applications mit Kubernetes
Search
Nicolas Byl
September 21, 2017
Technology
0
63
Stateful Applications mit Kubernetes
Nicolas Byl
September 21, 2017
Tweet
Share
More Decks by Nicolas Byl
See All by Nicolas Byl
Die Flucht aus der Prototypen-Hölle
nbyl
0
37
Lean Prototyping for Industrial-IoT Projects
nbyl
0
30
DevSecOps - Vom Unikum zur gut geölten Maschine
nbyl
0
83
Securing your software supply chain
nbyl
0
340
Keeping-Up-WithUpstream.pdf
nbyl
0
140
Dr. Kube und der Helm - Anatomie einer CD-Pipeline
nbyl
0
100
Securing the "other" supply chain
nbyl
0
230
Kubernetes - Auf die Cluster, Fertig, Los!
nbyl
0
150
Helm - Kubernetes Deployments richtig gemacht
nbyl
0
120
Other Decks in Technology
See All in Technology
一歩ずつ成長しながら進める ZOZOの基幹システムリプレイス/Growing Stap by Stap ZOZO BackOffice System Replacement
cocet33000
2
350
俯瞰と個別の⼆つの視点で紡ぐ スクラムマスターの成⻑と協働 / Dual Views Weaving Scrum Master Growth
toma_sm
1
100
貧民的プログラミングのすすめ
kakehashi
PRO
2
330
スクラムというコンフォートゾーンから抜け出そう!プロジェクト全体に目を向けるインセプションデッキ / Inception Deck for seeing the whole project
takaking22
4
350
いまからでも遅くない!コンテナでWebアプリを動かしてみよう!コンテナハンズオン編
nomu
0
200
エンジニア主導の企画立案を可能にする組織とは?
recruitengineers
PRO
1
350
フォーイット_エンジニア向け会社紹介資料_Forit_Company_Profile.pdf
forit_tech
1
1.7k
Global Databaseで実現するマルチリージョン自動切替とBlue/Greenデプロイ
j2yano
0
210
自分のやることに価値を見出だせるようになり、挑戦する勇気をもらったベイトソンの考え / Scrum Fest Fukuoka 2025
bonbon0605
0
180
プロダクト開発者目線での Entra ID 活用
sansantech
PRO
0
250
OCI IAM Identity Domains Entra IDとの認証連携設定手順 / Identity Domain Federation settings with Entra ID
oracle4engineer
PRO
1
1.4k
エンジニアリング 💰Moneyジャー / Engineering Money-ger
kenchan
1
220
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Why Our Code Smells
bkeepers
PRO
336
57k
GitHub's CSS Performance
jonrohan
1030
460k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
450
Faster Mobile Websites
deanohume
306
31k
For a Future-Friendly Web
brad_frost
176
9.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
193
16k
Testing 201, or: Great Expectations
jmmastey
42
7.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.6k
Designing Experiences People Love
moore
140
23k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Transcript
STATEFUL APPLICATIONS MIT KUBERNETES BED-CON 2017 Nicolas Byl, codecentric AG
1
2
PERSISTENT APPLICATION STATE 3 . 1
GOALS Scalable Highly Available Fault Tolerance 3 . 2
EXAMPLE ARCHITECTURE 3 . 3
CANDIDATES MySQL PostgreSQL Cassandra MongoDB Kafka … 3 . 4
KUBERNETES 4 . 1
DESIGN PHILOSOPHY portable: public, private, hybrid, multi-cloud extensible: modular, pluggable,
hookable, composable self-healing: auto-placement, auto-restart, auto-replication, auto-scaling 4 . 2
PODS 4 . 3
SERVICES 4 . 4
PERSISTENT VOLUMES 5 . 1
5 . 2
GCEPersistentDisk CephFS AWSElasticBlockStore Cinder (OpenStack block storage) AzureFile Glusterfs AzureDisk
VsphereVolume FC (Fibre Channel) Quobyte Volumes FlexVolume HostPath Flocker VMware Photon
NFS vPortworx Volumes iSCSI ScaleIO Volumes RBD (Ceph Block Device)
StorageOS 5 . 3
ACCESS MODES ReadWriteOnce – the volume can be mounted as
read-write by a single node ReadOnlyMany – the volume can be mounted read-only by many nodes ReadWriteMany – the volume can be mounted as read-write by many nodes 5 . 4
USAGE Provision Disk Create Persistent Volume Create Persistent Volume Claim
Mount Claim in Pod 5 . 5
PERSISTENT VOLUME apiVersion: v1 kind: PersistentVolume metadata: name: pv0003 spec:
capacity: storage: 5Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Recycle nfs: path: /tmp server: 172.17.0.2 5 . 6
PERSISTENT VOLUME CLAIM kind: PersistentVolumeClaim apiVersion: v1 metadata: name: myclaim
spec: accessModes: - ReadWriteOnce resources: requests: storage: 8Gi 5 . 7
MOUNTING A PVC kind: Pod apiVersion: v1 metadata: name: mypod
spec: containers: - name: mydatabase image: mysql:5.7 volumeMounts: - mountPath: "/var/lib/mysql" name: mypd volumes: - name: mypd persistentVolumeClaim: claimName: myclaim 5 . 8
COMMON PITFALLS The abstraction is leaky. Local storage vs. SAN
storage vs. Network Filesystems 5 . 9
AUTO-PROVISIONING 6 . 1
AUTO-PROVISIONING Manual creation of Persistent Volumes is error-prone. Does not
scale well. 6 . 2
STORAGECLASS kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: standard provisioner: kubernetes.io/aws-ebs
parameters: type: gp2 6 . 3
USING A STORAGECLASS kind: PersistentVolumeClaim apiVersion: v1 metadata: name: myclaim
spec: accessModes: - ReadWriteOnce resources: requests: storage: 8Gi storageClassName: standard 6 . 4
SUPPORTED PROVISIONERS default volume plugins (in-tree provisioners) out-of-tree provisioners community
provisioners: write your own: https://github.com/kubernetes- incubator/external-storage https://github.com/kubernetes- incubator/external- storage/tree/master/docs/demo/hostpath-provisioner 6 . 5
SCALING 7 . 1
ARCHITECTURE REVISITED 7 . 2
SHARING PVCS Need different paths per Pod. Share needs to
be available on every host. Corruption of file system affects all database nodes. Sharing a Persistent Volume Claim is not a good idea. 7 . 3
STATEFUL SETS 8 . 1
STATEFULSETS Pod template mechanism Hostnames are atomically increased: pod-0 pod-1
… Volume Claims can be provisioned on-the-fly 8 . 2
STATEFULSET EXAMPLE apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: web spec:
serviceName: "nginx" replicas: 2 template: metadata: labels: app: nginx spec: containers: - name: nginx image: gcr.io/google_containers/nginx-slim:0.8 ports: - containerPort: 80 name: web volumeMounts: 8 . 3
ARCHITECTURE STATEFULSETS 8 . 4
WRAP UP 9 . 1
LINKS Persistent Volumes: Tutorial StatefulSet: Demos: https://kubernetes.io/docs/concepts/storage/persistent- volumes https://kubernetes.io/docs/tutorials/stateful-application/basic- stateful-set/
https://goo.gl/NCnzq8 9 . 2
THE END Copyright 2017 @NicolasByl 9 . 3