Operators to the rescue: Manage your external data and legacy APIs from Kubernetes

A presentation at Devoxx Morocco 2024 in October 2024 in Marrakesh, Morocco by Horacio Gonzalez

Slide 1

Slide 1

Operators to the rescue: Manage your external data and legacy APIs from Kubernetes Sébastien Blanc Horacio Gonzalez

Slide 2

Slide 2

Who are we? Sébastien Blanc Horacio Gonzalez DevRel DevRel @sebi2706 @LostInBrittany

Slide 3

Slide 3

Kubernetes operators Helping to tame the complexity of K8s Ops

Slide 4

Slide 4

Taming microservices with Kubernetes

Slide 5

Slide 5

What about complex deployments

Slide 6

Slide 6

Tools like Helm helps with complexity

Slide 7

Slide 7

Helm Charts are configuration Operating is more than installs & upgrades

Slide 8

Slide 8

Kubernetes is about automation How about automating human operators?

Slide 9

Slide 9

Kubernetes Operators A Kubernetes version of the human operator

Slide 10

Slide 10

Building operators Basic K8s elements: Custom Resources & Controllers

Slide 11

Slide 11

Custom Resource Definitions Extending Kubernetes API

Slide 12

Slide 12

Extending Kubernetes API By defining new types of resources, internal or external to the cluster

Slide 13

Slide 13

With a CRD you can create CR in the cluster They are the blueprints of the Custom Resources

Slide 14

Slide 14

Custom Resources are simply data All the logic must be in the Controller

Slide 15

Slide 15

Kubernetes Controllers Keeping an eye on the resources

Slide 16

Slide 16

A reconcile loop Controllers watch the state of the cluster, and make or request changes where needed

Slide 17

Slide 17

Kubernetes Operator Automating operations

Slide 18

Slide 18

What’s a Kubernetes Operator?

Slide 19

Slide 19

Example: databases Things like adding an instance to a pool, doing a backup, sharding…

Slide 20

Slide 20

Knowledge encoded in CRDs and Controllers

Slide 21

Slide 21

Custom Controllers for Custom Resources Operators implement and manage Custom Resources using custom reconciliation logic

Slide 22

Slide 22

Operator Capability Model Gauging the operator maturity

Slide 23

Slide 23

Operators aren’t limited to K8s They can be used to pilot external APIs, i.e. non K8s software

Slide 24

Slide 24

Don’t put everything into Kubernetes

Slide 25

Slide 25

Operators simplify Kubernetes integration

Slide 26

Slide 26

A real, open-source example The Clever Operator

Slide 27

Slide 27

Available on Operator Hub & GitHub https://operatorhub.io/operator/clever-operator https://github.com/CleverCloud/clever-operator

Slide 28

Slide 28

Exposing Clever Cloud resources as CRD Allowing your apps to use our DBs as if they were in K8s

Slide 29

Slide 29

Many possible use-cases ● ● ● ● ● ● ● ● External Service Health Monitor Operator External API Token Rotation Operator Database Synchronization Operator Legacy System Configuration Management Operator File Transfer Operator (FTP/SFTP Automation) Cloud Billing/Cost Monitoring Operator DNS Management Operator …

Slide 30

Slide 30

How can we write Operators? Which language? Any framework?

Slide 31

Slide 31

They are simply pods and manifests You can simply call Kubernetes APIs or use a compatible client

Slide 32

Slide 32

The Operator Framework Open source framework to accelerate the development of an Operator

Slide 33

Slide 33

Hey Devoxx Morocco, operators ❤ Java

Slide 34

Slide 34

Let’s build an operator together Why? Because we can!

Slide 35

Slide 35

Let’s choose a use-case External Service Health Monitor Operator

Slide 36

Slide 36

Exposing Clever Cloud resources as CRD Allowing your apps to use our DBs as if they were in K8s

Slide 37

Slide 37

Let’s look at a real operator Dealing with external databases

Slide 38

Slide 38

Clever Cloud operator Allowing your apps to use our DBs as if they were in K8s

Slide 39

Slide 39

Operators can get lots of options Should devs need to know all of them?

Slide 40

Slide 40

Operators simplify Kubernetes integration

Slide 41

Slide 41

So you have a bunch of operators… Too many options again…

Slide 42

Slide 42

So many things to learn…

Slide 43

Slide 43

Managing the self-service commodity

Slide 44

Slide 44

Shift left and Cognitive Load

Slide 45

Slide 45

How about an operator to operate operators? One operator to rule them all

Slide 46

Slide 46

How about a Platform Engineering framework?

Slide 47

Slide 47

How about using an internal developer portal? Platform Stakeholders Developers Dev Manager VP Engineering DevOps CISO Internal developer portal

Slide 48

Slide 48

Portal’s main pillars Dashboards Software Catalog Scorecards Self-service RBAC Workflow automations