Démystifier la création d’opérateurs Kubernetes en Java avec Quarkus

A presentation at Nantes JUG in December 2024 in Nantes, France by Horacio Gonzalez

Slide 1

Slide 1

Demystifying Kubernetes Operators in Java with Quarkus 2024-12-17 - Nantes JUG Horacio Gonzalez

Slide 2

Slide 2

Who are we? Introducing myself and introducing Clever Cloud

Slide 3

Slide 3

Horacio Gonzalez @LostInBrittany Spaniard Lost in Brittany

Slide 4

Slide 4

Clever Cloud Our mission: give more speed to your teams and better quality to your projects

Slide 5

Slide 5

Kubernetes operators Helping to tame the complexity of K8s Ops

Slide 6

Slide 6

Taming microservices with Kubernetes

Slide 7

Slide 7

What about complex deployments

Slide 8

Slide 8

Tools like Helm helps with complexity

Slide 9

Slide 9

Helm Charts are configuration Operating is more than installs & upgrades

Slide 10

Slide 10

Kubernetes is about automation How about automating human operators?

Slide 11

Slide 11

Kubernetes Operators A Kubernetes version of the human operator

Slide 12

Slide 12

Building operators Basic K8s elements: Custom Resources & Controllers

Slide 13

Slide 13

Custom Resource Definitions Extending Kubernetes API

Slide 14

Slide 14

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

Slide 15

Slide 15

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

Slide 16

Slide 16

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

Slide 17

Slide 17

Kubernetes Controllers Keeping an eye on the resources

Slide 18

Slide 18

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

Slide 19

Slide 19

Kubernetes Operator Automating operations

Slide 20

Slide 20

What’s a Kubernetes Operator?

Slide 21

Slide 21

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

Slide 22

Slide 22

Knowledge encoded in CRDs and Controllers

Slide 23

Slide 23

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

Slide 24

Slide 24

Operator Capability Model Gauging the operator maturity

Slide 25

Slide 25

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

Slide 26

Slide 26

Don’t put everything into Kubernetes

Slide 27

Slide 27

Operators simplify Kubernetes integration

Slide 28

Slide 28

A real, open-source example The Clever Operator

Slide 29

Slide 29

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

Slide 30

Slide 30

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

Slide 31

Slide 31

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 32

Slide 32

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

Slide 33

Slide 33

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

Slide 34

Slide 34

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

Slide 35

Slide 35

Hey Devoxx Morocco, operators ❤ Java

Slide 36

Slide 36

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

Slide 37

Slide 37

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

Slide 38

Slide 38

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

Slide 39

Slide 39

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

Slide 40

Slide 40

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

Slide 41

Slide 41

Code available on GitHub https://github.com/sebi-and-horacio/external-health-monitor-operator