SlideShare ist ein Scribd-Unternehmen logo
1 von 78
Downloaden Sie, um offline zu lesen
Operator Lifecycle Management
1
Introduction
2
This Talk
3
• What is Operator Lifecycle Management
?

• Potential Tool
s

• Summary & Conclusions
4
Operator
 

Lifecycle Management
5
CRD
 

Lifecycle Management
6
Tools
7
Helm
8
👍 Popular & matur
e

👍 Easy to us
e

👍 Templating + User provided value
s

👍 Chart Hooks - Lifecycle hooks: pre-install, post-install, pre-upgrade,
…

👍 No server-side componen
t

👍 Wide range of integrations available: ArgoCD, Crossplane, …
Helm
9
👎👎👎 Poor CRD Lifecycle Management
👎 Limited Chart Dependency Managemen
t

Helm
10
OLM
11
ℹ Has a server side componen
t

👍 Designed solely for the purpose of managing operator
s

👍 Installation and upgrades are part of the OLM mode
l

👍 Installation = Creating a Subscription C
R

👍 Upgrades: updates „storedVersion“
fi
eld (after CRs have been migrated
)

👍 OperatorSDK helps with building OLM package
s

OLM
12
👎 Not a general purpose package manage
r

👎 No templating mechanism as with Helm: e.g. custom label
s

👎 No lifecycle hooks (nothing similar to Helm Chart Hooks
)

👎 Upgrading CRs has to be done automatically
OLM
13
Carvel
14
ℹ originates from VMware Tanz
u

ℹ Includes kapp CLI and kapp controller (server-side
)

👍 kapp allows templating (kustomize, ytt
)

👍 kapp controller - App CR - Similar to OLM Subscriptions + templatin
g

👍 CRD upgrades similar to OLM
Carvel
15
👎 Early stage project. Not widely adopted. Missing documentation
.

👎 No dependency managemen
t

👎 No hub such as ArtifactHub or OperatorHu
b

👎 Not as widely integrated into other tools
Carvel
16
Summary &
Conclusion
17
Helm doesn’t seem to
focus on operators.
18
Carvel is promising
but immature.
19
Hence, for now:
OLM.
20
There is room for
improvement.
21
Questions
?

@anynine
s

@
fi
scherjulian
22
Thank You!
23
Data Service
Automation
24
“Fully automating the entire lifecycle of a wide
range of data services to run on cloud-native
platforms across infrastructures at scale.”
25
Commit to a Mission
26
«K8s Cluster»
Operator
Service Instance (Operand)
A single K8s cluster
 

with a single service instance
managed by a single Operator.
27
«K8s Cluster»
Operator
Service Instance (Operand)
Service Instance (Operand)
Service Instance (Operand)
Service Instance (Operand)
A single K8s cluster
 

with multiple service-instances
managed by a single Operator.
28
«K8s Cluster»
PG
Operator
PG Service Instance (Operand) #1
PG Service Instance (Operand) #2
A single K8s cluster
 

with multiple service-instances
managed by a multiple
Operators.
PG Service Instance (Operand) #3
PG Service Instance (Operand) #4
Other
Operator
Other Service Instance (Operand) #5
Other Service Instance (Operand)
Other Service Instance (Operand)
Other Service Instance (Operand)
29
Many K8s clusters eac
h

with multiple service-instances
managed by a multiple
Operators.
100s or 1000s of
 

data service instances!
30
Scale Matters!
31
Each data service
instance matters!
32
Methodology
33
Principles
34
• Know your target audience. Requirements and desired qualities
.

• Choose your data services, wisely. Be aware of open source licenses
.

• Strive for full lifecycle automation
.

• On-demand provisioning of dedicated service instances
.

• Rebuild failed instances instead of
fi
xing them
.

• Design for scalability.
Principles
35
• Operational model
fi
rst, automation second
.

• Be a backup/restore hero
.

• Solve issues on the framework level,
fi
ne-tune data service speci
fi
cally
.

• Test code. Test service instances. Test desired and undesired behavior
.

• Provide meaningful default con
fi
guration values. Except custom con
fi
g
parameters.
Principles
36
• Don’t touch upstream code, except for …
 

• Master release managemen
t

• Deliver releases into target environments quickl
y

• Collect feedback from users (e.g. through support
)

• Provide meaningful documentation. Better documentation, less support.
Principles
37
Data Service Automatio
n

with Kubernetes
38
Ways to Implement a
n

„Operator“
39
• Kubernetes CRDs + Custom Controller
s

• Operator SD
K

• KUDO
Data Service Automation with K8s
40
Stages of
Development
41
• Operational Model - Level 1: What a sysop/DBA would do
.

• Operational Model - Level 2: Containerization, YAML + kubectl
• Operational Model - Level 3: Operato
r

• Operational Model - Level 4: Operator Lifecycle Management
Data Service Automation with K8s
42
CRDs
43
44
apiVersion: apiextensions.k8s.io/v1


kind: CustomResourceDefinition


metadata:


# name must match the spec fields below, and be in the form: <plural>.<group>


name: pgs.ds.a9s.io


spec:


# group name to use for REST API: /apis/<group>/<version>


group: ds.a9s.io


# list of versions supported by this CustomResourceDefinition


versions:


- name: v1


# Each version can be enabled/disabled by Served flag.


served: true


# One and only one version must be marked as the storage version.


storage: true


schema:


openAPIV3Schema:


type: object


description: Yeah! Science!


properties:


spec:


type: object


required: ["replicas"]


properties:


postgresVersion:


type: string


# pattern: major.minor.patchlevel or major.minor > determine patchlevel automatically


default: "12.2"


# postgresPlugins:


# type: array


replicas:


type: integer


# pattern: 2n+1


minimum: 1


default: 1


# either Namespaced or Cluster. Namespaced as data service instances should belong to a namespace.


scope: Namespaced


names:


# plural name to be used in the URL: /apis/<group>/<version>/<plural>


plural: pgs


# singular name to be used as an alias on the CLI and for display


singular: pg


# kind is normally the CamelCased singular type. Your resource manifests use this.


kind: PostgreSQL


# shortNames allow shorter string to match your resource on the CLI


shortNames:


- pg


- pgs
45
apiVersion: ds.a9s.io/v1


kind: PostgreSQL


metadata:


name: pg-1


spec:


postgresVersion: "12.2"


replicas: 3
• CRD = Custom Resource De
fi
nitio
n

• Introduce custom data structures to Kubernete
s

• Kubernetes provides an endpoint for managing these object
s

• Kubernetes provides persistency by storing them in its etcd.
K8s CRDs
46
Controllers
47
48
// [...]


// add adds a new Controller to mgr with r as the reconcile.Reconciler


func add(mgr manager.Manager, r reconcile.Reconciler) error {


// Create a new controller


// [...]


// Watch for changes to primary resource Memcached


err = c.Watch(&source.Kind{Type: &cachev1alpha1.Memcached{}}, &handler.EnqueueRequestForObject{})


if err != nil {


return err


}


// TODO(user): Modify this to be the types you create that are owned by the primary resource


// Watch for changes to secondary resource Pods and requeue the owner Memcached


err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{


IsController: true,


OwnerType: &cachev1alpha1.Memcached{},


})




// [...]


}
49
func (r *ReconcileMemcached) Reconcile(request reconcile.Request)
(reconcile.Result, error) {


reqLogger := log.WithValues("Request.Namespace", request.Namespace,
"Request.Name", request.Name)


reqLogger.Info("Reconciling Memcached")


// Fetch the Memcached instance


instance := &cachev1alpha1.Memcached{}


err := r.client.Get(context.TODO(), request.NamespacedName, instance) //
Retrieve the object


if err != nil {


if errors.IsNotFound(err) {


// Request object not found, could have been deleted after reconcile
request.


// Owned objects are automatically garbage collected. For additional
cleanup logic use finalizers.


// Return and don't requeue


return reconcile.Result{}, nil


}


// Error reading the object - requeue the request.


return reconcile.Result{}, err


}


// Define a new Pod object (similar to a YAML Spec)


pod := newPodForCR(instance)


if err := controllerutil.SetControllerReference(instance, pod, r.scheme);
err != nil {


return reconcile.Result{}, err


}




// Check if this Pod already exists


found := &corev1.Pod{} // Empty Pod object


err = r.client.Get(context.TODO(), types.NamespacedName{Name: pod.Name,
Namespace: pod.Namespace}, found)


// If an error occurs and in particular the error is of the type NotFound then
we know the Pod doesn't exist.


if err != nil && errors.IsNotFound(err) {


reqLogger.Info("Creating a new Pod", "Pod.Namespace", pod.Namespace,
"Pod.Name", pod.Name)


// Create the secondary objects ... in this case a single pod.


err = r.client.Create(context.TODO(), pod)


if err != nil {


return reconcile.Result{}, err


}


// Pod created successfully - don't requeue


return reconcile.Result{}, nil


} else if err != nil {


return reconcile.Result{}, err


}


// Pod already exists - don't requeue


reqLogger.Info("Skip reconcile: Pod already exists", "Pod.Namespace",
found.Namespace, "Pod.Name", found.Name)


return reconcile.Result{}, nil


}
• Read custom resource object speci
fi
cation
s

• Translate primary resources into a set of secondary resources
.

• E.g. a PostgreSQL resource into a Service and a StatefulSet
.

• Watches the primary spec for changes
.

• Ensures secondary resources to comply to the desired state of the primary’s
spec.
K8s Controllers
50
Common Pitfalls
51
• Underestimate complexity and effor
t

• Insuf
fi
cient coverage of essential lifecycle operation
s

• Too little robustness, observability and predictabilit
y

• Applying automation that doesn’t
fi
t the context
52
What
Organizations Want
53
• Expose lifecycle operations using Kubernetes Custom Resources (CRDs
)

• On-Demand Provisioning of Dedicated Service-Instance
s

• Allow con
fi
guration updates
• Provide monitoring of health and statu
s

• Infrastructure-agnosti
c

• Runs on different Kubernetes
fl
avors
.

• Authentication with dedicated user for each application accessing the DSI
54
• Horizontal 2n+1 DSI scalability: 1, 3, 5 ….
 

• Automatic failure detection and fail-over. Self-healing to recover degraded
clustered service instances
.

• Host-anti-af
fi
nity. Support for multiple AZs
.

• Vertical DSI scalability: replace small pods with larger pods with even larger
pods,
…

• Provide backup and restore capabilities with the ability to create backup
schedules.
55
• Stream backups to external object stores
.

• Allow choosing data service versions
.

• Documentation
.

• Encryption at rest and encryption at transit
.

•
…

56
The Long Life of a
Service Instance
57
Data Service Automation
58
Create Service Instance
Delete Service Instance
Add log sink
Add metrics sink
Add alerting rule
Vertical scale-up
Horizontal scale-out Create backup
Restore backup
Update Operator
Install Operator
Delete Operator
Update Operator Con
fi
guration
Patch-level upgrade
Minor upgrade
Major upgrade
Kubernetes Node Failure
Availability Zone Failure
Network Partitioning
Network Delay Fluctuation
Network Bandwidth Fluctuation
Enable (Postgresql) extension
Disable (Postgresql) extension
Create service-binding
Delete service-binding
Change con
fi
guration setting
Create a backup schedule
Service Bindings
59
Service Bindings
60
«K8s Cluster»
PG Operator
PG Service Instance (Operand)
A Service Binding represents the
connection between an app and a
data service instance.
«Microservice»


Microservice #1
«Microservice»


Microservice #2
Service Binding #1 Service Binding #2
Service Bindings
61
«K8s Cluster»
PG Operator
PG Service Instance (Operand)
A Service Binding comprises a
Kubernetes Secret as well as
 

a user in the managed data
service, e.g. a PostgreSQL user
.

Both user and secret are unique
to a particular Service Binding.
«Microservice»


Microservice #1
«Custom Resource»


Service Binding #1
PG User #1 for
Service Binding #1
«Secret»
with multiple service-instances
managed by a multiple
Operators.
«Backup»


Daily Backup for 2021-10-06
«Backup Plan»


Plan to do a daily backup
Technology
64
Writing
Controllers
65
Reconcilin
g

External Resources
66
67
«K8s Cluster»
PG Operator
PG Service Instance (Operand)
«Microservice»


Microservice #1
«Custom Resource»


Service Binding #1
PG User #1 for
Service Binding #1
«Secret»
Service Binding #1
«Secret»


PG User Controller
pg-user CR created CREATE USER user123 …
CREATE USER
69
70
«Custom Resource»


Service Binding #1
«Secret»


PG User Controller
pg-user CR created CREATE USER user123 …
{
Careful ⚠ This is not a transaction
.

Atomicity is not guaranteed.
💥
71
«Custom Resource»


Service Binding #1
«Secret»


PG User Controller
Inconsistent state
.

Secret ✅
Postgres user ❌
Be prepared to
 

re-reconcile by makin
g

actions idempotent.
72
CREATE USER
 

IF NOT EXISTS
73
74
«Custom Resource»


Service Binding #1
«Secret»


PG User Controller
Summary
75
Questions
?

@anynine
s

@
fi
scherjulian
76
Thank You!
77
Attic
78

Weitere ähnliche Inhalte

Ähnlich wie Operator Lifecycle Management

An intro to Kubernetes operators
An intro to Kubernetes operatorsAn intro to Kubernetes operators
An intro to Kubernetes operatorsJ On The Beach
 
Splunk: Druid on Kubernetes with Druid-operator
Splunk: Druid on Kubernetes with Druid-operatorSplunk: Druid on Kubernetes with Druid-operator
Splunk: Druid on Kubernetes with Druid-operatorImply
 
Kubernetes Internals
Kubernetes InternalsKubernetes Internals
Kubernetes InternalsShimi Bandiel
 
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...Tobias Schneck
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetesRishabh Indoria
 
Kubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-HassanKubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-HassanSyed Murtaza Hassan
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using GoCloudOps2005
 
Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Anthony Dahanne
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3sHaggai Philip Zagury
 
Kubernetes - training micro-dragons without getting burnt
Kubernetes -  training micro-dragons without getting burntKubernetes -  training micro-dragons without getting burnt
Kubernetes - training micro-dragons without getting burntAmir Moghimi
 
Kubernetes @ Squarespace: Kubernetes in the Datacenter
Kubernetes @ Squarespace: Kubernetes in the DatacenterKubernetes @ Squarespace: Kubernetes in the Datacenter
Kubernetes @ Squarespace: Kubernetes in the DatacenterKevin Lynch
 
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...NETWAYS
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesDataWorks Summit
 
ОЛЕГ МАЦЬКІВ «Crash course on Operator Framework» Lviv DevOps Conference 2019
ОЛЕГ МАЦЬКІВ «Crash course on Operator Framework» Lviv DevOps Conference 2019ОЛЕГ МАЦЬКІВ «Crash course on Operator Framework» Lviv DevOps Conference 2019
ОЛЕГ МАЦЬКІВ «Crash course on Operator Framework» Lviv DevOps Conference 2019UA DevOps Conference
 
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Orchestration tool roundup   kubernetes vs. docker vs. heat vs. terra form vs...Orchestration tool roundup   kubernetes vs. docker vs. heat vs. terra form vs...
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...Nati Shalom
 
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...Cloud Native Day Tel Aviv
 
Container & kubernetes
Container & kubernetesContainer & kubernetes
Container & kubernetesTed Jung
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)QAware GmbH
 
Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Idan Atias
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Anthony Dahanne
 

Ähnlich wie Operator Lifecycle Management (20)

An intro to Kubernetes operators
An intro to Kubernetes operatorsAn intro to Kubernetes operators
An intro to Kubernetes operators
 
Splunk: Druid on Kubernetes with Druid-operator
Splunk: Druid on Kubernetes with Druid-operatorSplunk: Druid on Kubernetes with Druid-operator
Splunk: Druid on Kubernetes with Druid-operator
 
Kubernetes Internals
Kubernetes InternalsKubernetes Internals
Kubernetes Internals
 
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...Kubernetes Cluster API - managing the infrastructure of  multi clusters (k8s ...
Kubernetes Cluster API - managing the infrastructure of multi clusters (k8s ...
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Kubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-HassanKubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-Hassan
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
 
Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3s
 
Kubernetes - training micro-dragons without getting burnt
Kubernetes -  training micro-dragons without getting burntKubernetes -  training micro-dragons without getting burnt
Kubernetes - training micro-dragons without getting burnt
 
Kubernetes @ Squarespace: Kubernetes in the Datacenter
Kubernetes @ Squarespace: Kubernetes in the DatacenterKubernetes @ Squarespace: Kubernetes in the Datacenter
Kubernetes @ Squarespace: Kubernetes in the Datacenter
 
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
 
ОЛЕГ МАЦЬКІВ «Crash course on Operator Framework» Lviv DevOps Conference 2019
ОЛЕГ МАЦЬКІВ «Crash course on Operator Framework» Lviv DevOps Conference 2019ОЛЕГ МАЦЬКІВ «Crash course on Operator Framework» Lviv DevOps Conference 2019
ОЛЕГ МАЦЬКІВ «Crash course on Operator Framework» Lviv DevOps Conference 2019
 
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Orchestration tool roundup   kubernetes vs. docker vs. heat vs. terra form vs...Orchestration tool roundup   kubernetes vs. docker vs. heat vs. terra form vs...
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
 
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
Uri Cohen & Dan Kilman, GigaSpaces - Orchestration Tool Roundup - OpenStack l...
 
Container & kubernetes
Container & kubernetesContainer & kubernetes
Container & kubernetes
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
 
Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)Introduction to Container Storage Interface (CSI)
Introduction to Container Storage Interface (CSI)
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !
 

Mehr von DoKC

Distributed Vector Databases - What, Why, and How
Distributed Vector Databases - What, Why, and HowDistributed Vector Databases - What, Why, and How
Distributed Vector Databases - What, Why, and HowDoKC
 
Is It Safe? Security Hardening for Databases Using Kubernetes Operators
Is It Safe? Security Hardening for Databases Using Kubernetes OperatorsIs It Safe? Security Hardening for Databases Using Kubernetes Operators
Is It Safe? Security Hardening for Databases Using Kubernetes OperatorsDoKC
 
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster RecoveryStop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster RecoveryDoKC
 
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...DoKC
 
The State of Stateful on Kubernetes
The State of Stateful on KubernetesThe State of Stateful on Kubernetes
The State of Stateful on KubernetesDoKC
 
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...DoKC
 
Make Your Kafka Cluster Production-Ready
Make Your Kafka Cluster Production-ReadyMake Your Kafka Cluster Production-Ready
Make Your Kafka Cluster Production-ReadyDoKC
 
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...DoKC
 
Run PostgreSQL in Warp Speed Using NVMe/TCP in the Cloud
Run PostgreSQL in Warp Speed Using NVMe/TCP in the CloudRun PostgreSQL in Warp Speed Using NVMe/TCP in the Cloud
Run PostgreSQL in Warp Speed Using NVMe/TCP in the CloudDoKC
 
The Kubernetes Native Database
The Kubernetes Native DatabaseThe Kubernetes Native Database
The Kubernetes Native DatabaseDoKC
 
ING Data Services hosted on ICHP DoK Amsterdam 2023
ING Data Services hosted on ICHP DoK Amsterdam 2023ING Data Services hosted on ICHP DoK Amsterdam 2023
ING Data Services hosted on ICHP DoK Amsterdam 2023DoKC
 
Implementing data and databases on K8s within the Dutch government
Implementing data and databases on K8s within the Dutch governmentImplementing data and databases on K8s within the Dutch government
Implementing data and databases on K8s within the Dutch governmentDoKC
 
StatefulSets in K8s - DoK Talks #154
StatefulSets in K8s - DoK Talks #154StatefulSets in K8s - DoK Talks #154
StatefulSets in K8s - DoK Talks #154DoKC
 
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...DoKC
 
Analytics with Apache Superset and ClickHouse - DoK Talks #151
Analytics with Apache Superset and ClickHouse - DoK Talks #151Analytics with Apache Superset and ClickHouse - DoK Talks #151
Analytics with Apache Superset and ClickHouse - DoK Talks #151DoKC
 
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...DoKC
 
Evaluating Cloud Native Storage Vendors - DoK Talks #147
Evaluating Cloud Native Storage Vendors - DoK Talks #147Evaluating Cloud Native Storage Vendors - DoK Talks #147
Evaluating Cloud Native Storage Vendors - DoK Talks #147DoKC
 
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...DoKC
 
We will Dok You! - The journey to adopt stateful workloads on k8s
We will Dok You! - The journey to adopt stateful workloads on k8sWe will Dok You! - The journey to adopt stateful workloads on k8s
We will Dok You! - The journey to adopt stateful workloads on k8sDoKC
 
Mastering MongoDB on Kubernetes, the power of operators
Mastering MongoDB on Kubernetes, the power of operators Mastering MongoDB on Kubernetes, the power of operators
Mastering MongoDB on Kubernetes, the power of operators DoKC
 

Mehr von DoKC (20)

Distributed Vector Databases - What, Why, and How
Distributed Vector Databases - What, Why, and HowDistributed Vector Databases - What, Why, and How
Distributed Vector Databases - What, Why, and How
 
Is It Safe? Security Hardening for Databases Using Kubernetes Operators
Is It Safe? Security Hardening for Databases Using Kubernetes OperatorsIs It Safe? Security Hardening for Databases Using Kubernetes Operators
Is It Safe? Security Hardening for Databases Using Kubernetes Operators
 
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster RecoveryStop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
 
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...
Transforming Data Processing with Kubernetes: Journey Towards a Self-Serve Da...
 
The State of Stateful on Kubernetes
The State of Stateful on KubernetesThe State of Stateful on Kubernetes
The State of Stateful on Kubernetes
 
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...
Colocating Data Workloads and Web Services on Kubernetes to Improve Resource ...
 
Make Your Kafka Cluster Production-Ready
Make Your Kafka Cluster Production-ReadyMake Your Kafka Cluster Production-Ready
Make Your Kafka Cluster Production-Ready
 
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...
Dynamic Large Scale Spark on Kubernetes: Empowering the Community with Argo W...
 
Run PostgreSQL in Warp Speed Using NVMe/TCP in the Cloud
Run PostgreSQL in Warp Speed Using NVMe/TCP in the CloudRun PostgreSQL in Warp Speed Using NVMe/TCP in the Cloud
Run PostgreSQL in Warp Speed Using NVMe/TCP in the Cloud
 
The Kubernetes Native Database
The Kubernetes Native DatabaseThe Kubernetes Native Database
The Kubernetes Native Database
 
ING Data Services hosted on ICHP DoK Amsterdam 2023
ING Data Services hosted on ICHP DoK Amsterdam 2023ING Data Services hosted on ICHP DoK Amsterdam 2023
ING Data Services hosted on ICHP DoK Amsterdam 2023
 
Implementing data and databases on K8s within the Dutch government
Implementing data and databases on K8s within the Dutch governmentImplementing data and databases on K8s within the Dutch government
Implementing data and databases on K8s within the Dutch government
 
StatefulSets in K8s - DoK Talks #154
StatefulSets in K8s - DoK Talks #154StatefulSets in K8s - DoK Talks #154
StatefulSets in K8s - DoK Talks #154
 
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
 
Analytics with Apache Superset and ClickHouse - DoK Talks #151
Analytics with Apache Superset and ClickHouse - DoK Talks #151Analytics with Apache Superset and ClickHouse - DoK Talks #151
Analytics with Apache Superset and ClickHouse - DoK Talks #151
 
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
Overcoming challenges with protecting and migrating data in multi-cloud K8s e...
 
Evaluating Cloud Native Storage Vendors - DoK Talks #147
Evaluating Cloud Native Storage Vendors - DoK Talks #147Evaluating Cloud Native Storage Vendors - DoK Talks #147
Evaluating Cloud Native Storage Vendors - DoK Talks #147
 
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...
Kubernetes Cluster Upgrade Strategies and Data: Best Practices for your State...
 
We will Dok You! - The journey to adopt stateful workloads on k8s
We will Dok You! - The journey to adopt stateful workloads on k8sWe will Dok You! - The journey to adopt stateful workloads on k8s
We will Dok You! - The journey to adopt stateful workloads on k8s
 
Mastering MongoDB on Kubernetes, the power of operators
Mastering MongoDB on Kubernetes, the power of operators Mastering MongoDB on Kubernetes, the power of operators
Mastering MongoDB on Kubernetes, the power of operators
 

Kürzlich hochgeladen

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Kürzlich hochgeladen (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Operator Lifecycle Management

  • 4. • What is Operator Lifecycle Management ? • Potential Tool s • Summary & Conclusions 4
  • 9. 👍 Popular & matur e 👍 Easy to us e 👍 Templating + User provided value s 👍 Chart Hooks - Lifecycle hooks: pre-install, post-install, pre-upgrade, … 👍 No server-side componen t 👍 Wide range of integrations available: ArgoCD, Crossplane, … Helm 9
  • 10. 👎👎👎 Poor CRD Lifecycle Management 👎 Limited Chart Dependency Managemen t Helm 10
  • 12. ℹ Has a server side componen t 👍 Designed solely for the purpose of managing operator s 👍 Installation and upgrades are part of the OLM mode l 👍 Installation = Creating a Subscription C R 👍 Upgrades: updates „storedVersion“ fi eld (after CRs have been migrated ) 👍 OperatorSDK helps with building OLM package s OLM 12
  • 13. 👎 Not a general purpose package manage r 👎 No templating mechanism as with Helm: e.g. custom label s 👎 No lifecycle hooks (nothing similar to Helm Chart Hooks ) 👎 Upgrading CRs has to be done automatically OLM 13
  • 15. ℹ originates from VMware Tanz u ℹ Includes kapp CLI and kapp controller (server-side ) 👍 kapp allows templating (kustomize, ytt ) 👍 kapp controller - App CR - Similar to OLM Subscriptions + templatin g 👍 CRD upgrades similar to OLM Carvel 15
  • 16. 👎 Early stage project. Not widely adopted. Missing documentation . 👎 No dependency managemen t 👎 No hub such as ArtifactHub or OperatorHu b 👎 Not as widely integrated into other tools Carvel 16
  • 18. Helm doesn’t seem to focus on operators. 18
  • 19. Carvel is promising but immature. 19
  • 21. There is room for improvement. 21
  • 25. “Fully automating the entire lifecycle of a wide range of data services to run on cloud-native platforms across infrastructures at scale.” 25 Commit to a Mission
  • 26. 26 «K8s Cluster» Operator Service Instance (Operand) A single K8s cluster with a single service instance managed by a single Operator.
  • 27. 27 «K8s Cluster» Operator Service Instance (Operand) Service Instance (Operand) Service Instance (Operand) Service Instance (Operand) A single K8s cluster with multiple service-instances managed by a single Operator.
  • 28. 28 «K8s Cluster» PG Operator PG Service Instance (Operand) #1 PG Service Instance (Operand) #2 A single K8s cluster with multiple service-instances managed by a multiple Operators. PG Service Instance (Operand) #3 PG Service Instance (Operand) #4 Other Operator Other Service Instance (Operand) #5 Other Service Instance (Operand) Other Service Instance (Operand) Other Service Instance (Operand)
  • 29. 29 Many K8s clusters eac h with multiple service-instances managed by a multiple Operators.
  • 30. 100s or 1000s of data service instances! 30
  • 35. • Know your target audience. Requirements and desired qualities . • Choose your data services, wisely. Be aware of open source licenses . • Strive for full lifecycle automation . • On-demand provisioning of dedicated service instances . • Rebuild failed instances instead of fi xing them . • Design for scalability. Principles 35
  • 36. • Operational model fi rst, automation second . • Be a backup/restore hero . • Solve issues on the framework level, fi ne-tune data service speci fi cally . • Test code. Test service instances. Test desired and undesired behavior . • Provide meaningful default con fi guration values. Except custom con fi g parameters. Principles 36
  • 37. • Don’t touch upstream code, except for … • Master release managemen t • Deliver releases into target environments quickl y • Collect feedback from users (e.g. through support ) • Provide meaningful documentation. Better documentation, less support. Principles 37
  • 39. Ways to Implement a n „Operator“ 39
  • 40. • Kubernetes CRDs + Custom Controller s • Operator SD K • KUDO Data Service Automation with K8s 40
  • 42. • Operational Model - Level 1: What a sysop/DBA would do . • Operational Model - Level 2: Containerization, YAML + kubectl • Operational Model - Level 3: Operato r • Operational Model - Level 4: Operator Lifecycle Management Data Service Automation with K8s 42
  • 44. 44 apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the form: <plural>.<group> name: pgs.ds.a9s.io spec: # group name to use for REST API: /apis/<group>/<version> group: ds.a9s.io # list of versions supported by this CustomResourceDefinition versions: - name: v1 # Each version can be enabled/disabled by Served flag. served: true # One and only one version must be marked as the storage version. storage: true schema: openAPIV3Schema: type: object description: Yeah! Science! properties: spec: type: object required: ["replicas"] properties: postgresVersion: type: string # pattern: major.minor.patchlevel or major.minor > determine patchlevel automatically default: "12.2" # postgresPlugins: # type: array replicas: type: integer # pattern: 2n+1 minimum: 1 default: 1 # either Namespaced or Cluster. Namespaced as data service instances should belong to a namespace. scope: Namespaced names: # plural name to be used in the URL: /apis/<group>/<version>/<plural> plural: pgs # singular name to be used as an alias on the CLI and for display singular: pg # kind is normally the CamelCased singular type. Your resource manifests use this. kind: PostgreSQL # shortNames allow shorter string to match your resource on the CLI shortNames: - pg - pgs
  • 45. 45 apiVersion: ds.a9s.io/v1 kind: PostgreSQL metadata: name: pg-1 spec: postgresVersion: "12.2" replicas: 3
  • 46. • CRD = Custom Resource De fi nitio n • Introduce custom data structures to Kubernete s • Kubernetes provides an endpoint for managing these object s • Kubernetes provides persistency by storing them in its etcd. K8s CRDs 46
  • 48. 48 // [...] // add adds a new Controller to mgr with r as the reconcile.Reconciler func add(mgr manager.Manager, r reconcile.Reconciler) error { // Create a new controller // [...] // Watch for changes to primary resource Memcached err = c.Watch(&source.Kind{Type: &cachev1alpha1.Memcached{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } // TODO(user): Modify this to be the types you create that are owned by the primary resource // Watch for changes to secondary resource Pods and requeue the owner Memcached err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{ IsController: true, OwnerType: &cachev1alpha1.Memcached{}, }) // [...] }
  • 49. 49 func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Result, error) { reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name) reqLogger.Info("Reconciling Memcached") // Fetch the Memcached instance instance := &cachev1alpha1.Memcached{} err := r.client.Get(context.TODO(), request.NamespacedName, instance) // Retrieve the object if err != nil { if errors.IsNotFound(err) { // Request object not found, could have been deleted after reconcile request. // Owned objects are automatically garbage collected. For additional cleanup logic use finalizers. // Return and don't requeue return reconcile.Result{}, nil } // Error reading the object - requeue the request. return reconcile.Result{}, err } // Define a new Pod object (similar to a YAML Spec) pod := newPodForCR(instance) if err := controllerutil.SetControllerReference(instance, pod, r.scheme); err != nil { return reconcile.Result{}, err } 
 // Check if this Pod already exists found := &corev1.Pod{} // Empty Pod object err = r.client.Get(context.TODO(), types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, found) // If an error occurs and in particular the error is of the type NotFound then we know the Pod doesn't exist. if err != nil && errors.IsNotFound(err) { reqLogger.Info("Creating a new Pod", "Pod.Namespace", pod.Namespace, "Pod.Name", pod.Name) // Create the secondary objects ... in this case a single pod. err = r.client.Create(context.TODO(), pod) if err != nil { return reconcile.Result{}, err } // Pod created successfully - don't requeue return reconcile.Result{}, nil } else if err != nil { return reconcile.Result{}, err } // Pod already exists - don't requeue reqLogger.Info("Skip reconcile: Pod already exists", "Pod.Namespace", found.Namespace, "Pod.Name", found.Name) return reconcile.Result{}, nil }
  • 50. • Read custom resource object speci fi cation s • Translate primary resources into a set of secondary resources . • E.g. a PostgreSQL resource into a Service and a StatefulSet . • Watches the primary spec for changes . • Ensures secondary resources to comply to the desired state of the primary’s spec. K8s Controllers 50
  • 52. • Underestimate complexity and effor t • Insuf fi cient coverage of essential lifecycle operation s • Too little robustness, observability and predictabilit y • Applying automation that doesn’t fi t the context 52
  • 54. • Expose lifecycle operations using Kubernetes Custom Resources (CRDs ) • On-Demand Provisioning of Dedicated Service-Instance s • Allow con fi guration updates • Provide monitoring of health and statu s • Infrastructure-agnosti c • Runs on different Kubernetes fl avors . • Authentication with dedicated user for each application accessing the DSI 54
  • 55. • Horizontal 2n+1 DSI scalability: 1, 3, 5 …. • Automatic failure detection and fail-over. Self-healing to recover degraded clustered service instances . • Host-anti-af fi nity. Support for multiple AZs . • Vertical DSI scalability: replace small pods with larger pods with even larger pods, … • Provide backup and restore capabilities with the ability to create backup schedules. 55
  • 56. • Stream backups to external object stores . • Allow choosing data service versions . • Documentation . • Encryption at rest and encryption at transit . • … 56
  • 57. The Long Life of a Service Instance 57
  • 58. Data Service Automation 58 Create Service Instance Delete Service Instance Add log sink Add metrics sink Add alerting rule Vertical scale-up Horizontal scale-out Create backup Restore backup Update Operator Install Operator Delete Operator Update Operator Con fi guration Patch-level upgrade Minor upgrade Major upgrade Kubernetes Node Failure Availability Zone Failure Network Partitioning Network Delay Fluctuation Network Bandwidth Fluctuation Enable (Postgresql) extension Disable (Postgresql) extension Create service-binding Delete service-binding Change con fi guration setting Create a backup schedule
  • 60. Service Bindings 60 «K8s Cluster» PG Operator PG Service Instance (Operand) A Service Binding represents the connection between an app and a data service instance. «Microservice» Microservice #1 «Microservice» Microservice #2 Service Binding #1 Service Binding #2
  • 61. Service Bindings 61 «K8s Cluster» PG Operator PG Service Instance (Operand) A Service Binding comprises a Kubernetes Secret as well as a user in the managed data service, e.g. a PostgreSQL user . Both user and secret are unique to a particular Service Binding. «Microservice» Microservice #1 «Custom Resource» Service Binding #1 PG User #1 for Service Binding #1 «Secret»
  • 62.
  • 63. with multiple service-instances managed by a multiple Operators. «Backup» Daily Backup for 2021-10-06 «Backup Plan» Plan to do a daily backup
  • 67. 67 «K8s Cluster» PG Operator PG Service Instance (Operand) «Microservice» Microservice #1 «Custom Resource» Service Binding #1 PG User #1 for Service Binding #1 «Secret»
  • 68. Service Binding #1 «Secret» PG User Controller pg-user CR created CREATE USER user123 …
  • 70. 70 «Custom Resource» Service Binding #1 «Secret» PG User Controller pg-user CR created CREATE USER user123 … { Careful ⚠ This is not a transaction . Atomicity is not guaranteed. 💥
  • 71. 71 «Custom Resource» Service Binding #1 «Secret» PG User Controller Inconsistent state . Secret ✅ Postgres user ❌
  • 72. Be prepared to re-reconcile by makin g actions idempotent. 72
  • 73. CREATE USER IF NOT EXISTS 73
  • 74. 74 «Custom Resource» Service Binding #1 «Secret» PG User Controller