SlideShare a Scribd company logo
1© 2018 All rights reserved.
Top 5 Considerations for
Running Stateful Apps on Kubernetes
Bogdan Matican
Founding Engineer, YugaByte
October 2018
2© 2018 All rights reserved.
Agenda
o About Us
o Why Run Stateful Apps on Kubernetes?
o Top 5 Considerations
1. High performance
2. Data resilience
3. Integration with application services
4. Day 2 operations
5. Automation with Operators
o Live Demo
o Q & A
3© 2018 All rights reserved.
About myself
Bogdan Matican,
Founding Engineer
• Facebook
• HBase
• Blobstore
• Stream processing
• UCar
• Monitoring solutions
• Data Analytics
• YugaByte
• Core DB
• Middleware and cloud integrations
• Tooling and automation
4© 2018 All rights reserved.
WHAT IS
YUGABYTE DB?
5© 2018 All rights reserved.
NoSQL + SQL Cloud Native
6© 2018 All rights reserved.
A transactional, high-performance database
for building planet-scale cloud services.
7© 2018 All rights reserved.
TRANSACTIONAL PLANET-SCALEHIGH PERFORMANCE
Distributed ACID Transactions
Document-Based, Strongly Consistent
Low Latency, Tunable Reads
High Throughput
CLOUD-NATIVE OPEN SOURCE
Apache 2.0
Popular APIs Extended
Apache Cassandra, Redis and PostgreSQL (coming soon)
Built For The Container Era
Self-Healing, Fault-Tolerant
Auto Sharding & Rebalancing
Global Data Distribution
YugaByte DB
8© 2018 All rights reserved.
Inside The Hood - 3 Node Cluster
DocDB Storage Engine
Purpose-built for ever-growing data, extended from RocksDB
yb-master1
yb-master3
yb-master2
YB-Master
Manage shard metadata &
coordinate cluster-wide ops
node1
node3
node2
Global Transaction Manager
Tracks ACID txns across multi-row ops, incl. clock skew mgmt.
Raft Consensus Replication
Highly resilient, used for both data replication & leader election
tablet 1’
tablet 1’
yb-tserver1 yb-tserver2
yb-tserver3
tablet 1’
tablet2-leader
tablet3-leader
tablet1-leaderYB-TServer
Stores/serves data in/from
tablets (shards)
tablet1-follower
tablet1-follower
tablet3-follower
tablet2-follower
tablet3-follower
tablet2-follower
…
…
…
9© 2018 All rights reserved.
YUGABYTE DB ON KUBERNETES
10© 2018 All rights reserved.
Why Run Stateful Apps on Kubernetes?
1. Unified orchestration across stateless & stateful apps
– Same set of compute/storage/network primitives across web server,
api server, message queue, cache, DB, file stores
2. Consistent, declarative provisioning across all envs
– minikube dev, intg test, failure test, perf test, staging, prod
3. Join one of the fastest-growing open source communities
– influence your peers and shape the future!
11© 2018 All rights reserved.
Starting a YugaByte DB Cluster
https://docs.yugabyte.com/deploy/multi-node-cluster/
Stable network IDs Persistent volumesOrdered operations
STATEFUL
2. Start as many yb-tservers as needed
1. Start all yb-masters first (usually 3)
12© 2018 All rights reserved.
Mapping to Kubernetes Controller APIs
DEPLOYMENT
Handles updates
(rolling/recreation) on
ReplicaSets
Most commonly used
REPLICASET
Run N identical Pods
Can only use
ephemeral storage
(pod loss = data loss)
DAEMONSET
Max 1 Pod per node
For node-level
functions
(e.g. monitoring)
JOB
Ensure N successful
completions
For batch jobs such as
crons
NOT FOR STATEFUL
APPS
13© 2018 All rights reserved.
StatefulSets API
1. Ordered operations with ordinal index
– Startup, scale-up, scale-down, rolling upgrades, termination
2. Stable, unique network ID/name across restarts
– Re-spawning a pod will not make the cluster treat it as a new member
3. Stable, persistent storage (linked to ordinal index/name)
– Attach same persistent disk to a pod even if it gets rescheduled to new node
4. Mandatory headless service (no single IP) for integrations
– No load balancer, smart clients aware of all pods and connect to any
Alpha
v1.3
Jul 2016
Beta
v1.5
Dec 2016
Stable
v1.9
Dec 2017
Purpose-built for stateful apps
14© 2018 All rights reserved.
YugaByte DB Deployed as StatefulSets
node2node1 node4node3
yb-master
StatefulSet yugabytedb
yb-master-1 pod
yugabytedb
yb-master-0 pod
yugabytedb
yb-master-2 pod
yb-tserver
StatefulSet
tablet 1’
yugabytedb
yb-tserver-1 podtablet 1’
yugabytedb
yb-tserver-0 pod tablet 1’
yugabytedb
yb-tserver-3 podtablet 1’
yugabytedb
yb-tserver-2 pod
…
Local/Remote
Persistent Volume
Local/Remote
Persistent Volume
Local/Remote
Persistent Volume
Local/Remote
Persistent Volume
yb-masters
Headless Service
yb-tservers
Headless Service
App ClientsAdmin Clients
15© 2018 All rights reserved.
YB-Master
yb-masters
Headless Service
yb-master StatefulSet
Access the yb-masters service as
$name.$namespace.svc.cluster.local
3 pods
https://github.com/YugaByte/yugabyte-db/blob/master/cloud/kubernetes/yugabyte-statefulset-local-ssd-gke.yaml
ui & rpc ports
volume mountpath matches fs_data_dirs
Headless
16© 2018 All rights reserved.
YB-TServer
yb-tservers
Headless Service
yb-tserver StatefulSet
Access the yb-masters service as
$name.$namespace.svc.cluster.local
3 pods to begin with, scale as needed
https://github.com/YugaByte/yugabyte-db/blob/master/cloud/kubernetes/yugabyte-statefulset-local-ssd-gke.yaml
ui, rpc, cassandra & redis ports
volume mountpath matches
fs_data_dirs
Headless
17© 2018 All rights reserved.
Other Examples
http://blog.kubernetes.io/2017/02/postgresql-
clusters-kubernetes-statefulsets.html
https://www.slideshare.net/JoergHenning/elasticsearch-on-kubernetes
18© 2018 All rights reserved.
STATEFUL KUBERNETES APPS –
WHAT TO CONSIDER
19© 2018 All rights reserved.
1. Ensuring High Performance
LOCAL STORAGE
(Beta since v1.10) (Stable)
REMOTE STORAGE
Lower latency, Higher throughput
Recommended for workloads that do their own
replication
Pre-provision outside of K8s
Use SSDs for latency-sensitive apps
Higher latency, Lower throughput
Recommended for workloads do not perform any
replication on their own
Provision dynamically in K8s
Use alongside local storage for cost-efficient tiering
20© 2018 All rights reserved.
2. Configuring Data Resilience
POD ANTI-AFFINITY MULTI-ZONE/REGIONAL/MULTI-REGION
POD SCHEDULING
Pods of the same type should not be
scheduled on the same node
Keeps impact of node failures to
absolute minimum
(Beta since v1.10)
Multi-Zone - Tolerate zone failures for
k8s slave nodes
Regional – Tolerate zone failures for
both k8s slave and master nodes [GKE
only]
Multi-Region – Requires federation of
k8s clusters
21© 2018 All rights reserved.
3. Integrating StatefulSets with App Services
https://www.slideshare.net/ssuser6bb12d/kubernetes-introduction-71846110
preferred for clarity/readability
22© 2018 All rights reserved.
4. Running Day 2 Operations
BACKUP & RESTORE
Backups and restores are a
database level construct
YugaByte DB can perform
distributed snapshot and copy to a
target for a backup
Restore the backup into an
existing cluster or a new cluster
with a different number of tservers
ROLLING UPGRADES
Supports two upgradeStrategies:
onDelete (default) and
rollingUpgrade
Pick rolling upgrade strategy for
DBs that support zero downtime
upgrades such as YugaByte DB
New instance of the pod spawned
with same network id and storage
HANDLING FAILURES
Pod failure handled by K8S
automatically
Node failure has to be handled
manually by adding a new slave
node to K8S cluster
Local storage failure has to be
handled manually by mounting
new local volume to K8S
23© 2018 All rights reserved.
5. Extending StatefulSets with Operators
https://kubernetes.io/docs/concepts/api-extension/custom-resources/#custom-controllers
Based on Custom Controllers that have direct
access to lower level K8S API
Excellent fit for stateful apps requiring human
operational knowledge to correctly scale,
reconfigure and upgrade while simultaneously
ensuring high performance and data resilience
Complementary to Helm for packaging
CPU usage in the yb-tserver
StatefulSet
Scale yb-tserver by 1 pod
CPU > 80% for 1min and
max_threshold not exceeded
24© 2018 All rights reserved.
A Real-World Example
Yugastore – E-Commerce app on the YERN stack
Deployed on
github.com/YugaByte/yugastore
25© 2018 All rights reserved.
Kubernetes Deployment Architecture
yb-master
StatefulSet yugabytedb
yb-master-1 pod
yugabytedb
yb-master-0 pod
yugabytedb
yb-master-2 pod
yb-tserver
StatefulSet
tablet 1’
yugabytedb
yb-tserver-1 podtablet 1’
yugabytedb
yb-tserver-0 pod tablet 1’
yugabytedb
yb-tserver-2 pod
yb-masters
Headless Service
yb-master-ui
LoadBalancer Service
yb-tservers
Headless Service yugastore
Deployment
tablet 1’
yugastore
yugastore-1 podtablet 1’
yugastore
yugastore-0 pod
yugastore
LoadBalancer Service
End User
Admin User
26© 2018 All rights reserved.
DEMO
27© 2018 All rights reserved.
Summary
1. StatefulSets are getting increasingly more powerful
2. Ensuring high performance and data resilience requires
careful planning
3. Day 2 operations are getting simpler (thx to Operators)
4. Community ready to help if you want to get started!
28© 2018 All rights reserved.
Try YugaByte DB on your laptop
docs.yugabyte.com/latest/quick-start
29© 2018 All rights reserved.
gitter.im/YugaByte
@YugaByte
Questions?

More Related Content

PPTX
Scale Transactional Apps Across Multiple Regions with Low Latency
PPTX
Demystifying Kubernetes Statefulsets
PPTX
How YugaByte DB Implements Distributed PostgreSQL
PDF
Distributed SQL Databases Deconstructed
PPTX
YugaByte DB on Kubernetes - An Introduction
PPTX
YugaByte DB Internals - Storage Engine and Transactions
PDF
YugaByte DB—A Planet-Scale Database for Low Latency Transactional Apps
PDF
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB
Scale Transactional Apps Across Multiple Regions with Low Latency
Demystifying Kubernetes Statefulsets
How YugaByte DB Implements Distributed PostgreSQL
Distributed SQL Databases Deconstructed
YugaByte DB on Kubernetes - An Introduction
YugaByte DB Internals - Storage Engine and Transactions
YugaByte DB—A Planet-Scale Database for Low Latency Transactional Apps
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB

What's hot (20)

PDF
How-To: Zero Downtime Migrations from Oracle to a Cloud-Native PostgreSQL
PPTX
Bootstrapping state in Apache Flink
PPTX
Why you should use native packages to install PostgreSQL on Linux
 
PPTX
Automating Postgres Deployments on AWS and VMware, with Terraform and Ansible
 
PDF
Present & Future of Greenplum Database A massively parallel Postgres Database...
POTX
Building Effective Apache Geode Applications with Spring Data GemFire
PDF
PostgreSQL continuous backup and PITR with Barman
 
PPTX
How to Monitor Postgres Like a Pro!
 
PPTX
Installing Postgres on Linux
 
PPTX
Cloud Native PostgreSQL
 
PPTX
Using Apache Geode: Lessons Learned at Southwest Airlines
PDF
Does Anyone Really Need RAC?
 
PPTX
Apache AGE and the synergy effect in the combination of Postgres and NoSQL
 
PPTX
An Introduction to Apache Geode (incubating)
PDF
Learn How Dell Improved Postgres/Greenplum Performance 20x with a Database Pr...
PPTX
The Need For Speed - Strategies to Modernize Your Data Center
 
PDF
YugabyteDB - Distributed SQL Database on Kubernetes
PPTX
Webinar: Managing Postgres at Scale
 
PDF
Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
PPTX
Webinar: Operating Kubernetes at Scale
How-To: Zero Downtime Migrations from Oracle to a Cloud-Native PostgreSQL
Bootstrapping state in Apache Flink
Why you should use native packages to install PostgreSQL on Linux
 
Automating Postgres Deployments on AWS and VMware, with Terraform and Ansible
 
Present & Future of Greenplum Database A massively parallel Postgres Database...
Building Effective Apache Geode Applications with Spring Data GemFire
PostgreSQL continuous backup and PITR with Barman
 
How to Monitor Postgres Like a Pro!
 
Installing Postgres on Linux
 
Cloud Native PostgreSQL
 
Using Apache Geode: Lessons Learned at Southwest Airlines
Does Anyone Really Need RAC?
 
Apache AGE and the synergy effect in the combination of Postgres and NoSQL
 
An Introduction to Apache Geode (incubating)
Learn How Dell Improved Postgres/Greenplum Performance 20x with a Database Pr...
The Need For Speed - Strategies to Modernize Your Data Center
 
YugabyteDB - Distributed SQL Database on Kubernetes
Webinar: Managing Postgres at Scale
 
Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
Webinar: Operating Kubernetes at Scale
Ad

Similar to Running Stateful Apps on Kubernetes (20)

PPTX
Scylla on Kubernetes: Introducing the Scylla Operator
ODP
Stateful applications on kubernetes
PDF
Why kubernetes for Serverless (FaaS)
PDF
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
PDF
The Highs and Lows of Stateful Containers
PPTX
Being Stateful In Kubernetes
PDF
Being Stateful in Kubernetes
PDF
Meetup-#1-Getting-Started.pdf
PDF
Designing Stateful Apps for Cloud and Kubernetes
PPTX
Containerized Storage for Containers- Kubernetes LA Meetup , July 2017
PDF
Kubernetes
PDF
1. CNCF kubernetes meetup - Ondrej Sika
PPTX
YugaByte + PKS CloudFoundry Meetup 10/15/2018
PPTX
Kubernetes 101 VMworld 2019 workshop slides
PDF
Docker Madison, Introduction to Kubernetes
PDF
Kubernetes meetup - 2018-05-23
PDF
Managing Stateful Applications in Kubernetes
PDF
reBuy on Kubernetes
PPTX
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
PDF
Running a database on local NVMes on Kubernetes
Scylla on Kubernetes: Introducing the Scylla Operator
Stateful applications on kubernetes
Why kubernetes for Serverless (FaaS)
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
The Highs and Lows of Stateful Containers
Being Stateful In Kubernetes
Being Stateful in Kubernetes
Meetup-#1-Getting-Started.pdf
Designing Stateful Apps for Cloud and Kubernetes
Containerized Storage for Containers- Kubernetes LA Meetup , July 2017
Kubernetes
1. CNCF kubernetes meetup - Ondrej Sika
YugaByte + PKS CloudFoundry Meetup 10/15/2018
Kubernetes 101 VMworld 2019 workshop slides
Docker Madison, Introduction to Kubernetes
Kubernetes meetup - 2018-05-23
Managing Stateful Applications in Kubernetes
reBuy on Kubernetes
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
Running a database on local NVMes on Kubernetes
Ad

Recently uploaded (20)

PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Essential Infomation Tech presentation.pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administraation Chapter 3
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
history of c programming in notes for students .pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Upgrade and Innovation Strategies for SAP ERP Customers
Essential Infomation Tech presentation.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Odoo Companies in India – Driving Business Transformation.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administraation Chapter 3
Design an Analysis of Algorithms II-SECS-1021-03
history of c programming in notes for students .pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
CHAPTER 2 - PM Management and IT Context
How Creative Agencies Leverage Project Management Software.pdf
L1 - Introduction to python Backend.pptx
Softaken Excel to vCard Converter Software.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free

Running Stateful Apps on Kubernetes

  • 1. 1© 2018 All rights reserved. Top 5 Considerations for Running Stateful Apps on Kubernetes Bogdan Matican Founding Engineer, YugaByte October 2018
  • 2. 2© 2018 All rights reserved. Agenda o About Us o Why Run Stateful Apps on Kubernetes? o Top 5 Considerations 1. High performance 2. Data resilience 3. Integration with application services 4. Day 2 operations 5. Automation with Operators o Live Demo o Q & A
  • 3. 3© 2018 All rights reserved. About myself Bogdan Matican, Founding Engineer • Facebook • HBase • Blobstore • Stream processing • UCar • Monitoring solutions • Data Analytics • YugaByte • Core DB • Middleware and cloud integrations • Tooling and automation
  • 4. 4© 2018 All rights reserved. WHAT IS YUGABYTE DB?
  • 5. 5© 2018 All rights reserved. NoSQL + SQL Cloud Native
  • 6. 6© 2018 All rights reserved. A transactional, high-performance database for building planet-scale cloud services.
  • 7. 7© 2018 All rights reserved. TRANSACTIONAL PLANET-SCALEHIGH PERFORMANCE Distributed ACID Transactions Document-Based, Strongly Consistent Low Latency, Tunable Reads High Throughput CLOUD-NATIVE OPEN SOURCE Apache 2.0 Popular APIs Extended Apache Cassandra, Redis and PostgreSQL (coming soon) Built For The Container Era Self-Healing, Fault-Tolerant Auto Sharding & Rebalancing Global Data Distribution YugaByte DB
  • 8. 8© 2018 All rights reserved. Inside The Hood - 3 Node Cluster DocDB Storage Engine Purpose-built for ever-growing data, extended from RocksDB yb-master1 yb-master3 yb-master2 YB-Master Manage shard metadata & coordinate cluster-wide ops node1 node3 node2 Global Transaction Manager Tracks ACID txns across multi-row ops, incl. clock skew mgmt. Raft Consensus Replication Highly resilient, used for both data replication & leader election tablet 1’ tablet 1’ yb-tserver1 yb-tserver2 yb-tserver3 tablet 1’ tablet2-leader tablet3-leader tablet1-leaderYB-TServer Stores/serves data in/from tablets (shards) tablet1-follower tablet1-follower tablet3-follower tablet2-follower tablet3-follower tablet2-follower … … …
  • 9. 9© 2018 All rights reserved. YUGABYTE DB ON KUBERNETES
  • 10. 10© 2018 All rights reserved. Why Run Stateful Apps on Kubernetes? 1. Unified orchestration across stateless & stateful apps – Same set of compute/storage/network primitives across web server, api server, message queue, cache, DB, file stores 2. Consistent, declarative provisioning across all envs – minikube dev, intg test, failure test, perf test, staging, prod 3. Join one of the fastest-growing open source communities – influence your peers and shape the future!
  • 11. 11© 2018 All rights reserved. Starting a YugaByte DB Cluster https://docs.yugabyte.com/deploy/multi-node-cluster/ Stable network IDs Persistent volumesOrdered operations STATEFUL 2. Start as many yb-tservers as needed 1. Start all yb-masters first (usually 3)
  • 12. 12© 2018 All rights reserved. Mapping to Kubernetes Controller APIs DEPLOYMENT Handles updates (rolling/recreation) on ReplicaSets Most commonly used REPLICASET Run N identical Pods Can only use ephemeral storage (pod loss = data loss) DAEMONSET Max 1 Pod per node For node-level functions (e.g. monitoring) JOB Ensure N successful completions For batch jobs such as crons NOT FOR STATEFUL APPS
  • 13. 13© 2018 All rights reserved. StatefulSets API 1. Ordered operations with ordinal index – Startup, scale-up, scale-down, rolling upgrades, termination 2. Stable, unique network ID/name across restarts – Re-spawning a pod will not make the cluster treat it as a new member 3. Stable, persistent storage (linked to ordinal index/name) – Attach same persistent disk to a pod even if it gets rescheduled to new node 4. Mandatory headless service (no single IP) for integrations – No load balancer, smart clients aware of all pods and connect to any Alpha v1.3 Jul 2016 Beta v1.5 Dec 2016 Stable v1.9 Dec 2017 Purpose-built for stateful apps
  • 14. 14© 2018 All rights reserved. YugaByte DB Deployed as StatefulSets node2node1 node4node3 yb-master StatefulSet yugabytedb yb-master-1 pod yugabytedb yb-master-0 pod yugabytedb yb-master-2 pod yb-tserver StatefulSet tablet 1’ yugabytedb yb-tserver-1 podtablet 1’ yugabytedb yb-tserver-0 pod tablet 1’ yugabytedb yb-tserver-3 podtablet 1’ yugabytedb yb-tserver-2 pod … Local/Remote Persistent Volume Local/Remote Persistent Volume Local/Remote Persistent Volume Local/Remote Persistent Volume yb-masters Headless Service yb-tservers Headless Service App ClientsAdmin Clients
  • 15. 15© 2018 All rights reserved. YB-Master yb-masters Headless Service yb-master StatefulSet Access the yb-masters service as $name.$namespace.svc.cluster.local 3 pods https://github.com/YugaByte/yugabyte-db/blob/master/cloud/kubernetes/yugabyte-statefulset-local-ssd-gke.yaml ui & rpc ports volume mountpath matches fs_data_dirs Headless
  • 16. 16© 2018 All rights reserved. YB-TServer yb-tservers Headless Service yb-tserver StatefulSet Access the yb-masters service as $name.$namespace.svc.cluster.local 3 pods to begin with, scale as needed https://github.com/YugaByte/yugabyte-db/blob/master/cloud/kubernetes/yugabyte-statefulset-local-ssd-gke.yaml ui, rpc, cassandra & redis ports volume mountpath matches fs_data_dirs Headless
  • 17. 17© 2018 All rights reserved. Other Examples http://blog.kubernetes.io/2017/02/postgresql- clusters-kubernetes-statefulsets.html https://www.slideshare.net/JoergHenning/elasticsearch-on-kubernetes
  • 18. 18© 2018 All rights reserved. STATEFUL KUBERNETES APPS – WHAT TO CONSIDER
  • 19. 19© 2018 All rights reserved. 1. Ensuring High Performance LOCAL STORAGE (Beta since v1.10) (Stable) REMOTE STORAGE Lower latency, Higher throughput Recommended for workloads that do their own replication Pre-provision outside of K8s Use SSDs for latency-sensitive apps Higher latency, Lower throughput Recommended for workloads do not perform any replication on their own Provision dynamically in K8s Use alongside local storage for cost-efficient tiering
  • 20. 20© 2018 All rights reserved. 2. Configuring Data Resilience POD ANTI-AFFINITY MULTI-ZONE/REGIONAL/MULTI-REGION POD SCHEDULING Pods of the same type should not be scheduled on the same node Keeps impact of node failures to absolute minimum (Beta since v1.10) Multi-Zone - Tolerate zone failures for k8s slave nodes Regional – Tolerate zone failures for both k8s slave and master nodes [GKE only] Multi-Region – Requires federation of k8s clusters
  • 21. 21© 2018 All rights reserved. 3. Integrating StatefulSets with App Services https://www.slideshare.net/ssuser6bb12d/kubernetes-introduction-71846110 preferred for clarity/readability
  • 22. 22© 2018 All rights reserved. 4. Running Day 2 Operations BACKUP & RESTORE Backups and restores are a database level construct YugaByte DB can perform distributed snapshot and copy to a target for a backup Restore the backup into an existing cluster or a new cluster with a different number of tservers ROLLING UPGRADES Supports two upgradeStrategies: onDelete (default) and rollingUpgrade Pick rolling upgrade strategy for DBs that support zero downtime upgrades such as YugaByte DB New instance of the pod spawned with same network id and storage HANDLING FAILURES Pod failure handled by K8S automatically Node failure has to be handled manually by adding a new slave node to K8S cluster Local storage failure has to be handled manually by mounting new local volume to K8S
  • 23. 23© 2018 All rights reserved. 5. Extending StatefulSets with Operators https://kubernetes.io/docs/concepts/api-extension/custom-resources/#custom-controllers Based on Custom Controllers that have direct access to lower level K8S API Excellent fit for stateful apps requiring human operational knowledge to correctly scale, reconfigure and upgrade while simultaneously ensuring high performance and data resilience Complementary to Helm for packaging CPU usage in the yb-tserver StatefulSet Scale yb-tserver by 1 pod CPU > 80% for 1min and max_threshold not exceeded
  • 24. 24© 2018 All rights reserved. A Real-World Example Yugastore – E-Commerce app on the YERN stack Deployed on github.com/YugaByte/yugastore
  • 25. 25© 2018 All rights reserved. Kubernetes Deployment Architecture yb-master StatefulSet yugabytedb yb-master-1 pod yugabytedb yb-master-0 pod yugabytedb yb-master-2 pod yb-tserver StatefulSet tablet 1’ yugabytedb yb-tserver-1 podtablet 1’ yugabytedb yb-tserver-0 pod tablet 1’ yugabytedb yb-tserver-2 pod yb-masters Headless Service yb-master-ui LoadBalancer Service yb-tservers Headless Service yugastore Deployment tablet 1’ yugastore yugastore-1 podtablet 1’ yugastore yugastore-0 pod yugastore LoadBalancer Service End User Admin User
  • 26. 26© 2018 All rights reserved. DEMO
  • 27. 27© 2018 All rights reserved. Summary 1. StatefulSets are getting increasingly more powerful 2. Ensuring high performance and data resilience requires careful planning 3. Day 2 operations are getting simpler (thx to Operators) 4. Community ready to help if you want to get started!
  • 28. 28© 2018 All rights reserved. Try YugaByte DB on your laptop docs.yugabyte.com/latest/quick-start
  • 29. 29© 2018 All rights reserved. gitter.im/YugaByte @YugaByte Questions?