Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Deep Dive into the Operator Pattern for Non-Clustered Resources

A Deep Dive into the Operator Pattern for Non-Clustered Resources

SQUER Solutions

November 23, 2022
Tweet

More Decks by SQUER Solutions

Other Decks in Technology

Transcript

  1. A Deep Dive into the Operator Pattern for Non-Clustered Resources

    José Molero @jmlero | [email protected] DevOps Vienna Meetup, 23.11.2022
  2. Platform Infrastructure Kafka Kafka DevTeam 1 Git CRs YAML Kubernetes

    Kube-api Operator CRD 2 4 3 Git Repository Kubernetes components
  3. Operator — Overview Extensibility model for CR (Custom Resources) Embed

    automated operations logic for CR lifecycle management Supports the Kubernetes control loop architecture
  4. 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
  5. 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
  6. 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
  7. 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/
  8. Pitfalls Implementation could become complex Manage changes/upgrades in CRD Manage

    the state of external resources • Caching validation • Finalizers
  9. A Deep Dive into the Operator Pattern for Non-Clustered Resources

    José Molero @jmlero | [email protected] DevOps Vienna Meetup, 23.11.2022