Demystifying K8s Operators
Docker Meetup – Dell EMC
$whoami
 Suman Chakraborty - Sr. Devops
Platform Engineer @SAP Labs
 Community member @Docker
Bangalore, Collabnix
 Tech Blogger mostly on PaaS &
Opensource stuffs
https://www.linkedin.com/in/
schakraborty007/
@suman123
Kubernetes 101
 Open source platform for managing, orchestrating and deploying
container workloads.
 Google open source (Borg)- 2014, name originated from helmsman or
pilot
 Ensures scalability and separation of workloads.
 Distributed architecture with clear segregation of control plane and data
plane
 Application management through native stable resources (pods,
deployments, replicasets, services)
 Allows extending the API through custom resource defintions.
‘Stateless’ vs ‘Stateful’
Stateless is EASY !!!
$ kubectl scale deployment web --replicas=3
Deployment
app=web, env=prod
Pod
app=web, env=prod
Scale Out
desired =3 count =1
start
count =3
Stateful is hard !!!
 Stateful applications require application domain knowledge to
correctly scale, upgrade and reconfigure while protecting data loss
or unavailability.
eg – distributed database, caches and monitoring systems.
 Needs stable persistent storage. Requires application specific
notion of clustering and interconnectivity.
 Requires coordination for authentication and authorization of
cluster members.
 Coordination is again needed during resizing and upgrading.
 Needs backup and lifecycle management operations.
Kubernetes Operators ~ the Savior !!!
 “An Operator is a method of packaging, deploying and managing a
Kubernetes application” – CoreOS
 Extends the Kubernetes API to enable management of multiple
instances of a complex stateful application.
 Leverages powerful Kubernetes extraction of resources and
controllers by including domain-specific knowledge to automate
common tasks.
Operators allow developers to focus on business logic on the desired
configuration , not the details of manual deployment and lifecycle
management
Components of an Operator
 Custom Resources :
 Custom resource is an extension of the Kubernetes API that is not
necessarily available in a default Kubernetes installation.
 Created through dynamic registration and perform CRUD operation.
 Managed independently of the cluster itself using ‘kubectl’ as
managed for Kubernetes resources.
apiVersion: mysql.oracle.com/v1
kind: MySQLCluster
metadata:
name: my-db-cluster
spec:
replicas: 3
multiMaster: true
Components of
an Operator
 Custom Controllers :
 Controller uses a ‘declarative API’ to
declare or specify the desired state of
the resource and tries to keep the
current state of Kubernetes objects in
sync with the desired state.
 Controllers can be updated
independent of cluster own lifecycle.
101 ways to build an operator
 go language :
• client-go & co.
• operator-sdk
• KUDO (Kubernetes Universal Declarative Operator)
• kubebuilder
 Other languages :
• kubernetes python and java clients and others
 Other tools:
• helm
• ansible
Operator Framework
Build: Enables developers
to build Operators based on
their expertise without
requiring knowledge of
Kubernetes API complexities
Run: Oversees installation,
updates and management
of the lifecycle of all of the
Operators
Operate (beta phase): Enables
usage reporting for Operators
that provide specialized
services.
Lifecycle Manager Operation
https://operatorhub.io/
THANK YOU

Demystifying k8s operators

  • 1.
  • 2.
    $whoami  Suman Chakraborty- Sr. Devops Platform Engineer @SAP Labs  Community member @Docker Bangalore, Collabnix  Tech Blogger mostly on PaaS & Opensource stuffs https://www.linkedin.com/in/ schakraborty007/ @suman123
  • 3.
    Kubernetes 101  Opensource platform for managing, orchestrating and deploying container workloads.  Google open source (Borg)- 2014, name originated from helmsman or pilot  Ensures scalability and separation of workloads.  Distributed architecture with clear segregation of control plane and data plane  Application management through native stable resources (pods, deployments, replicasets, services)  Allows extending the API through custom resource defintions.
  • 4.
    ‘Stateless’ vs ‘Stateful’ Statelessis EASY !!! $ kubectl scale deployment web --replicas=3 Deployment app=web, env=prod Pod app=web, env=prod Scale Out desired =3 count =1 start count =3
  • 5.
    Stateful is hard!!!  Stateful applications require application domain knowledge to correctly scale, upgrade and reconfigure while protecting data loss or unavailability. eg – distributed database, caches and monitoring systems.  Needs stable persistent storage. Requires application specific notion of clustering and interconnectivity.  Requires coordination for authentication and authorization of cluster members.  Coordination is again needed during resizing and upgrading.  Needs backup and lifecycle management operations.
  • 6.
    Kubernetes Operators ~the Savior !!!  “An Operator is a method of packaging, deploying and managing a Kubernetes application” – CoreOS  Extends the Kubernetes API to enable management of multiple instances of a complex stateful application.  Leverages powerful Kubernetes extraction of resources and controllers by including domain-specific knowledge to automate common tasks. Operators allow developers to focus on business logic on the desired configuration , not the details of manual deployment and lifecycle management
  • 7.
    Components of anOperator  Custom Resources :  Custom resource is an extension of the Kubernetes API that is not necessarily available in a default Kubernetes installation.  Created through dynamic registration and perform CRUD operation.  Managed independently of the cluster itself using ‘kubectl’ as managed for Kubernetes resources. apiVersion: mysql.oracle.com/v1 kind: MySQLCluster metadata: name: my-db-cluster spec: replicas: 3 multiMaster: true
  • 8.
    Components of an Operator Custom Controllers :  Controller uses a ‘declarative API’ to declare or specify the desired state of the resource and tries to keep the current state of Kubernetes objects in sync with the desired state.  Controllers can be updated independent of cluster own lifecycle.
  • 9.
    101 ways tobuild an operator  go language : • client-go & co. • operator-sdk • KUDO (Kubernetes Universal Declarative Operator) • kubebuilder  Other languages : • kubernetes python and java clients and others  Other tools: • helm • ansible
  • 10.
    Operator Framework Build: Enablesdevelopers to build Operators based on their expertise without requiring knowledge of Kubernetes API complexities Run: Oversees installation, updates and management of the lifecycle of all of the Operators Operate (beta phase): Enables usage reporting for Operators that provide specialized services. Lifecycle Manager Operation
  • 11.
  • 13.