Slide 1

Slide 1 text

Automating Stateful Applications with Kubernetes Operators Josh Wood Developer Advocate Red Hat

Slide 2

Slide 2 text

2 Why should you care about Operators?

Slide 3

Slide 3 text

3 Any application in any system must be installed, configured, managed and upgraded over time Patching is critical to security

Slide 4

Slide 4 text

“Anything that isn’t automated is slowing you down” 4

Slide 5

Slide 5 text

5 What is Kubernetes? An open source orchestration system for managing containerized workloads across a cluster of nodes.

Slide 6

Slide 6 text

6 Kubernetes Object Definitions kind: Pod apiVersion: v1 metadata: name: example-app spec: containers: - name: example image: quay.io/my/app:v1.2.0 [...]

Slide 7

Slide 7 text

Kubernetes is a declarative platform 7

Slide 8

Slide 8 text

8 Scaling stateless apps: easy

Slide 9

Slide 9 text

9 $ kubectl scale deploy/staticweb --replicas=3

Slide 10

Slide 10 text

10 scale up count=1 desired=3 ReplicaSet

Slide 11

Slide 11 text

11 start count=3 desired=3 ReplicaSet

Slide 12

Slide 12 text

12 What about apps that store data?

Slide 13

Slide 13 text

13 Deploying a database is easy

Slide 14

Slide 14 text

14 $ kubectl create deployment db --image=quay.io/my/db

Slide 15

Slide 15 text

15 Running a database over time is harder

Slide 16

Slide 16 text

16 ⏣ Resize/Upgrade ⏣ Reconfigure ⏣ Backup ⏣ Healing

Slide 17

Slide 17 text

17 If only Kubernetes knew...

Slide 18

Slide 18 text

18

Slide 19

Slide 19 text

19

Slide 20

Slide 20 text

20 Operators are automated software managers that manage the entire lifecycle of Kubernetes applications

Slide 21

Slide 21 text

21 1. Application-specific custom controllers 2. Custom resource definitions (CRD) Extending the Kubernetes API

Slide 22

Slide 22 text

22 Custom Resource Developer / Kubernetes User Deployments StatefulSets Autoscalers Secrets Config maps PersistentVolume How Does an Operator Work? K8s API kind: ProductionReadyDatabase apiVersion: database .example.com/v1alpha1 metadata: name: my-important -database spec: connectionPoolSize: 300 readReplicas: 2 version: v4.0.1 Custom Kubernetes Controller Watch Events Reconciliation + Custom Resource Definition Kubernetes Operator Native Kubernetes Resources

Slide 23

Slide 23 text

23 Custom Resource (CR) kind: ProductionReadyDatabase apiVersion: database.example.com/v1alpha1 metadata: name: my-production-ready-database spec: clusterSize: 3 readReplicas: 2 version: v4.0.1 [...]

Slide 24

Slide 24 text

24 What is etcd? Example: etcd Operator ● distributed key-value store ● At the heart of Kubernetes ● Vault, many other apps ● Your apps...

Slide 25

Slide 25 text

25 Example: etcd Operator kind: EtcdCluster apiVersion: etcd.database.coreos.com/v1beta2 metadata: name: example-etcd-cluster spec: size: 3 version: "3.2.13"

Slide 26

Slide 26 text

26 Use Operators Today OperatorHub.io is a home for the Kubernetes community to share Operators. Find an existing Operator or list your own today.

Slide 27

Slide 27 text

27 Operator Highlights MATURITY LEVEL 4 OPERATORS MATURITY LEVEL 5 OPERATORS

Slide 28

Slide 28 text

28 https://github.com/operator-framework

Slide 29

Slide 29 text

29

Slide 30

Slide 30 text

OPERATOR SDK KUBERNETES OPERATOR + = AUTHOR “create new operator” scaffolding custom logic

Slide 31

Slide 31 text

31 Operator Maturity Model Phase I Phase II Phase III Phase IV Phase V Basic Install Automated application provisioning and configuration management Seamless Upgrades Patch and minor version upgrades supported Full Lifecycle App lifecycle, storage lifecycle (backup, failure recovery) Deep Insights Metrics, alerts, log processing and workload analysis Auto Pilot Horizontal/vertical scaling, auto config tuning, abnormal detection, scheduling tuning

Slide 32

Slide 32 text

32 https://learn.openshift.com/operatorframework/ Try It! Hands-On Operator Tutorials

Slide 33

Slide 33 text

33 https://github.com/operator-framework https://operatorhub.io https://learn.openshift.com/operatorframework/ http://bit.ly/kubernetes-operators Resources

Slide 34

Slide 34 text

No content