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
64
Stateful Applications mit Kubernetes
Nicolas Byl
September 21, 2017
Tweet
Share
More Decks by Nicolas Byl
See All by Nicolas Byl
Platform Engineering ❤️ Developer Experience
nbyl
0
2
Die Flucht aus der Prototypen-Hölle
nbyl
0
43
Lean Prototyping for Industrial-IoT Projects
nbyl
0
42
DevSecOps - Vom Unikum zur gut geölten Maschine
nbyl
0
98
Securing your software supply chain
nbyl
0
360
Keeping-Up-WithUpstream.pdf
nbyl
0
160
Dr. Kube und der Helm - Anatomie einer CD-Pipeline
nbyl
0
120
Securing the "other" supply chain
nbyl
0
270
Kubernetes - Auf die Cluster, Fertig, Los!
nbyl
0
180
Other Decks in Technology
See All in Technology
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
9.1k
Modernizing Virtio GPU: A Rust-Powered Approach with vhost-device-gpu
ennael
PRO
0
100
"プロポーザルってなんか怖そう"という境界を超えてみた@TSUDOI by giftee Tech #1
shilo113
0
120
GA technologiesでのAI-Readyの取り組み@DataOps Night
yuto16
0
280
PLaMoの事後学習を支える技術 / PFN LLMセミナー
pfn
PRO
9
3.9k
AIAgentの限界を超え、 現場を動かすWorkflowAgentの設計と実践
miyatakoji
0
150
Azure Well-Architected Framework入門
tomokusaba
1
330
OCI Network Firewall 概要
oracle4engineer
PRO
1
7.8k
Modern_Data_Stack最新動向クイズ_買収_AI_激動の2025年_.pdf
sagara
0
220
ユニットテストに対する考え方の変遷 / Everyone should watch his live coding
mdstoy
0
130
10年の共創が示す、これからの開発者と企業の関係 ~ Crossroad
soracom
PRO
1
550
20250929_QaaS_vol20
mura_shin
0
130
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
61k
The Straight Up "How To Draw Better" Workshop
denniskardys
237
140k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.1k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Building Applications with DynamoDB
mza
96
6.6k
Building Adaptive Systems
keathley
43
2.8k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
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