Managing Database Containers with Kubernetes Operators and Docker

EdithPuclla 30 views 53 slides Jul 19, 2024
Slide 1
Slide 1 of 53
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53

About This Presentation

In this talk, we will discuss how Kubernetes Operators and Docker work together to manage database containers, focusing on PostgreSQL, MySQL, and MongoDB.
We will break down the complexity and show how these tools simplify managing stateful applications.

I'll also introduce Percona Everest, an...


Slide Content

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

Kubernetes Terminology Pods Deployments Services

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 worker 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 ? Stateful

“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…

‹#› 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

Pods Services Deployments Kubernetes CookBook

Pods Services Kubernetes CookBook Deployments Dragon Fruit Salad

Pods Services Kubernetes CookBook Deployments Dragon Fruit Salad Dragon Fruit Salad

Custom Resource Definitions (CRD)

‹#› Custom Resource Definitions (CRD) my-crontab.yaml

‹#›

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 == Custom Resource Other K8s objects Optionally Modify

Kubernetes With/Without Operators bit.ly/3UGB423

How do I create the operators? ‹#›

‹#› Capability Level

‹#›

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!

‹#› You can use Kubernetes to run production databases effectively Smaller databases = Kubernetes expertise Need automation + scaling Operators

‹#› Production database in Kubernetes is not a good idea yet Huge databases = New to Kubernetes Performance sensitive Manual deployments

‹#› Percona Operators simplify setting up and maintaining robust, enterprise-grade MySQL, PostgreSQL, and MongoDB clusters on Kubernetes Try Percona Operators: Percona Operator for MySQL P ercona Operator for Mongo DB P ercona Operator for PostgreSQL Open Source github.com/percona

Percona Everest open source, cloud-native database platform docs.percona.com/everest Open Source github.com/percona/everest

Thank you! edith.puclla @percona.com edithpuclla @edithpuclla