Managing Database Containers
with Kubernetes Operators
and Docker
● Technology Evangelist at
● Move UK Global Talent Visa
● CNCF Ambassador
● Docker Captain
● Open Source Contributor:
○ Kubernetes Website
○ Kubernetes Shadow Release 1.3
Edith Puclla
Edith Puclla @edithpuclla
○ Docker
○ Kubernetes
■ Deploying an Application
■ Default Resources
■ Limitations
○ Kubernetes Operators
■ Components
● CRD, CR, OLM, Controllers
■ Operator framework, Operator Hub, Capability Models
Agenda
Containers
OPERATING SYSTEM
PROCESS Container
Kubernetes
● Deployment automation
● Scaling based on demand
● Application portability
● Self-healing
● Good option for microservices
● Active community and wide adoption
KubernetesTerminology
Pods
Deploy
ments
Service
s
Building a Snack Voting App with Docker and
Kubernetes
Example: Snack Voting Application
voting-app result-app
KodeKloud:www.youtube.com/watch?v=XuSQU5Grv1g
CHIPS
100%
CHOCOLATE
0%
CHIPS
CHOCOLATE
voting-app result-app
DB
worker
Containers
Valkey
Pods
6379
5432
80
80
POD
POD
POD
POD
POD
voting-app result-app
Valkey DB
worker
Services
6379
5432
80
80
POD
POD
POD
POD
POD
voting-app result-app
Valkey DB
worker
Service
Service
Service
Service
DEPLOYMENT
DEPLOYMENT
DEPLOYMENT
DEPLOYMENT
DEPLOYMENT
Service
Service
POD
POD
POD
POD
POD
voting-
app
result-
app
Valkey DB
worke
r
Service
Service
POD
voting-app
POD
result-
app
POD
voting-
app
POD
result-
app
Deployments
YAML
The Architecture Before the
Operator Show
UI
CLI
API Server
Scheduler
Controller-Manager
etcd
Docker
kubelet kube-proxy
Container 1
Control Plane
User
Interface
Worker node 1
Container 2
Container 3
Container 1
Container 1
Container 2
Pod 1 Pod 2 Pod 3
Docker
kubelet kube-proxy
Container 1
Worker node 1
Container 2
Container 3
Container 1
Container 1
Container 2
Pod 1 Pod 2 Pod 3
kubectl
Kubernetes Operators
Stateless Application
Scaling: Easy
kubectl scale deploy/staticweb --replicas=4
kubectl scale deploy/staticweb --replicas=2
What about applications that store data?
“Deploy” a database: easy
POD
DB
I am the
persistent
volume!
Muahahahaha!
Muahaha!
Kubernetes Application Lifecycle
Running a database over time is the hardest
Kubernetes Operators
In Action!
Super…
28
Kubernetes Operators:
Extend the Kubernetes API
UI
CLI
API Server
Scheduler
Controller-Manager
etcd
Docker
kubelet kube-proxy
Container 1
Control Plane
User
Interface
Worker node 1
Container 2
Container 3
Container 1
Container 1
Container 2
Pod 1 Pod 2 Pod 3
Docker
kubelet kube-proxy
Container 1
Worker node 1
Container 2
Container 3
Container 1
Container 1
Container 2
Pod 1 Pod 2 Pod 3
kubectl
How the API is Extended:
● Custom Resource Definitions (CRD)
● Custom controllers for specific applications
Dragon
Fruit
Salad
Dragon
Fruit
Salad
Dragon
Fruit
Salad
Custom
Resource
Definitions
(CRD)
36
Custom Resource Definitions (CRD)
my-crontab.yaml
37
Custom Controller
Observes changes to resources defined in the CRD in the Kubernetes cluster,
detects changes, and reacts to level them out.
RECONCILE
DESIRED
STATE
CURRENT
STATE
==
CustomResource
Other K8s objects
Optionally
Modify
Kubernetes With/Without Operators
bit.ly/3UGB423
How do I create the operators?
40
42
Capability Level
43
©2024 Percona
More interesting timeline observations
● 2015 - Kubernetes is for the brave
● 2017 - AWS EKS Preview release
● 2018 - Kelsey Hightower: “Kubernetes supports stateful workloads; I don't.”
● 2019 - Percona Operators for MySQL and MongoDB released
● 2019-2021 - Databases on Kubernetes are for the brave
● 2022 - Data on Kubernetes says 70% of companies run stateful on k8s in production
● 2023 - Kelsey Hightower admits running DBs on k8s is okay
Is it still for the brave?
No.
But there are some implication.
It is not for everything, but anyone can try!
48
You can use
Kubernetes to run
production databases
effectively
Smaller databases
=
Kubernetes expertise
Need automation +
scaling
Operators
49
Production database in
Kubernetes is not a
good idea yet
Huge databases
=
New to Kubernetes
Performance sensitive Manual deployments
50
Percona Operators simplify setting up and maintaining robust, enterprise-grade
MySQL, PostgreSQL, and MongoDB clusters on Kubernetes
Try Percona Operators:
➔ Percona Operator for MySQL
➔ Percona Operator for MongoDB
➔ Percona Operator for PostgreSQL
github.com/percona
Percona Everest open source, cloud-native database platform
➔ docs.percona.com/everest
github.com/percona/everest
Thank you!
edith.puclla@percona.com edithpuclla @edithpuclla

Managing Database Containers with Kubernetes Operators and Docker

Editor's Notes

  • #47 Keysey knew we needed to work harder on these challenges, and over time it became possible and mature for us to run stateful applications on Kubernetes. —--------------------------------- Essentially, Kubernetes can facilitate database deployment and provide some level of automation and scalability, but it doesn't automatically provide the extensive managed services features that come with solutions like Cloud SQL. Understanding and implementing these additional features in Kubernetes require more sophisticated configuration and management, that is the "biggest challenge."