Operator — Overview
Extensibility model for CR (Custom Resources)
Embed automated operations logic for CR lifecycle
management
Supports the Kubernetes control loop architecture
Slide 9
Slide 9 text
Operator — Reconciler
apiVersion: apps/v1
kind: Deployment
metadata:
name: myDeployment
spec:
replicas: 3
…
Reconcile
apply
Desired
State
Report
Status
Actual
State
Knowing the desired state
Fetch the actual state
Actions to go from actual to desired state
Slide 10
Slide 10 text
Operator — CRD
Custom Resource Definition
• Extensions of the Kubernetes API
• CRDs enables Kubernetes to store
our custom resource in etcd
• Manage our custom resources like
a built in Kubernetes resource
apiVersion: cache.example.com/v1alpha1
kind: KafkaTopic
metadata:
name: myTopic
spec:
numPartitions: 5
replicationFactor: 1
Slide 11
Slide 11 text
Operator-SDK
Deep-Dive
Slide 12
Slide 12 text
Operator-SDK
Set of open source tools for
building and packaging operators
Uses controller-runtime’s Client
interface
• Controller Go library by the
Kubernetes-sig
• Kubebuilder compatible
Helm, ansible and Go
Slide 13
Slide 13 text
DEMO 🌱
Create my first operator.
Slide 14
Slide 14 text
Operator-SDK with GO
Operator-sdk supports the creation
of operators in Go
• Flexible and powerful
Operator-sdk generates most of
the needed skeleton code
• Custom Resource Definition (CRDs)
• A skeleton controller
• Custom reconciliation loop to the
controller
https://blog.deckhouse.io/
Slide 15
Slide 15 text
DEMO 🔥
Understanding the Controller.
Slide 16
Slide 16 text
Pitfalls
Implementation could become complex
Manage changes/upgrades in CRD
Manage the state of external resources
• Caching validation
• Finalizers
Slide 17
Slide 17 text
DEMO 🛳
Build and Deploy.
Slide 18
Slide 18 text
T.HANKS
Slide 19
Slide 19 text
A Deep Dive into the
Operator Pattern for
Non-Clustered
Resources
José Molero
@jmlero | [email protected]
DevOps Vienna Meetup, 23.11.2022