SlideShare a Scribd company logo
An intro to Kubernetes operators
Lili Cosic
Software Engineer at Red Hat
Twitter: @LiliCosic
Github: lilic
An Intro to Kubernetes Operators - Lili Cosic2
Intro to Kubernetes
An Intro to Kubernetes Operators - Lili Cosic3
Kubernetes
What is Kubernetes?
● Open source platform for managing containerized
workloads and services
● Containers, containers, containers
● Name originates from Greek - helmsman or pilot
● Google open-sourced in 2014
● Based on Borg - Google’ internal project
● K_ _ _ _ _ _ _ _S -> k8s
An Intro to Kubernetes Operators - Lili Cosic4
Kubernetes
What is great about Kubernetes?
● Scalability of workloads
● Separation of workloads
● Native stable resources (Deployments, Pods)
● API / Custom Resources
An Intro to Kubernetes Operators - Lili Cosic5
Kubernetes
What is Kubernetes not?
● Not a PaaS
● Not limited to the types of apps supported
● Not opinionated on:
○ Deploying
○ Run CI/CD
○ Logging, monitoring or alerting
An Intro to Kubernetes Operators - Lili Cosic6
Kubernetes controllers
An Intro to Kubernetes Operators - Lili Cosic7
What is a controller?
● Reconciles given state
● Controller pattern
○ Non terminating loop that regulates the state of the system
○ A control loop that watches the shared state of the cluster via the API server and
makes changes to move from current to desired state
An Intro to Kubernetes Operators - Lili Cosic8
ReplicaSet controller
Example controller
● ReplicaSet
○ Created by a Deployments
○ Creates Pods
● Reconciles to the correct (specified) number of pods running the cluster
An Intro to Kubernetes Operators - Lili Cosic9
Controller
Credit: github.com/kubernetes/sample-controller
An Intro to Kubernetes Operators - Lili Cosic10
Informer pattern
More important API functions
● ListWatcher
○ Helps you filter resources you want to watch
● ResourceEventHandler
○ Add, Update and Delete event trigger functions
An Intro to Kubernetes Operators - Lili Cosic11
Workqueue?
● Resource Event Handler puts an item to the workqueue
● Workqueue consists of keys:
○ <resource_namespace>/<resource_name>
● Only one worker works on one item at a time
● First In First Out
An Intro to Kubernetes Operators - Lili Cosic12
CRD - Custom Resource Definition
An Intro to Kubernetes Operators - Lili Cosic13
CRD - custom resource definition
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: crontabs.stable.example.com
spec:
# group name to use for REST API: /apis/<group>/<version>
group: stable.example.com
# 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
# either Namespaced or Cluster
scope: Namespaced
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: crontabs
# singular name to be used as an alias on the CLI and for display
singular: crontab
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: CronTab
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- ct
An Intro to Kubernetes Operators - Lili Cosic14
Operators, operators, operators
An Intro to Kubernetes Operators - Lili Cosic15
An Intro to Kubernetes Operators - Lili Cosic16
What is an “operator”?
Operator is a K8s controller - specific to operating an application
An Intro to Kubernetes Operators - Lili Cosic17
What is an “operator”?
● Non core Kubernetes controller
● Makes use of CRDs - custom resource definition
● Holds the knowledge of how an application needs to be deployed, managed and
packaged
● Reconcile loop
● Extends the Kubernetes API to make the application a custom resource - part of the
Kubernetes ecosystem
● Concept introduced by CoreOS
An Intro to Kubernetes Operators - Lili Cosic18
Good examples of operators
Awesome operators!
● github.com/coreos/prometheus-operator
● github.com/zalando-incubator/postgres-operator
● github.com/coreos/etcd-operator
An Intro to Kubernetes Operators - Lili Cosic19
When to choose creating an operator?
● Application uses declarative API
● Resources are scoped to a namespace or a cluster
● Encapsulate business logic
● Build automation that watches for updates of Kubernetes objects
● Create or update resources via the Kubernetes native API
● Top level support from kubectl
An Intro to Kubernetes Operators - Lili Cosic20
When to just use a ConfigMap or Secret?
Sometimes creating an operator is not needed
● Existing well known config file format (e.g. mysql.cnf )
● Config file is used to just configure an application running in a Pod
● No need to reconcile to the state
An Intro to Kubernetes Operators - Lili Cosic21
101 ways to build an operator
● go language:
○ client-go & co.
○ operator-sdk
○ kubebuilder
● Other languages:
○ Kubernetes python and java clients and others
● Other tools:
○ helm
○ ansible
An Intro to Kubernetes Operators - Lili Cosic22
Building operators using Kubernetes native
clients
An Intro to Kubernetes Operators - Lili Cosic23
Kubernetes native clients
● k8s.io/client-go
○ rest
○ discovery
○ dynamic
● k8s.io/api
● ks8.io/apimachinery
An Intro to Kubernetes Operators - Lili Cosic24
Kubernetes native clients
Pros
● Same as upstream controllers use
● Stability of K8s code
● Versioning based on Kubernetes releases
● Ability to finetune
Cons
● Large ecosystem
● No abstractions/helpers
● A lot of inside knowledge to optimize correctly
● New major version on every Kubernetes minor
version release
An Intro to Kubernetes Operators - Lili Cosic25
Using Kubernetes native go clients
Example of an “operator”
github.com/kubernetes/sample-controller
An Intro to Kubernetes Operators - Lili Cosic26
kubebuilder
An Intro to Kubernetes Operators - Lili Cosic27
kubebuilder
● github.com/kubernetes-sigs/kubebuilder
● SDK for building Kubernetes APIs using CRDs
● Part of kubernetes-sigs repo
● Uses controller-runtime under the hood
● Doesn’t strictly advertise itself as operator builder tool
An Intro to Kubernetes Operators - Lili Cosic28
Using kubebuilder
Example of a go operator
$ mkdir kubebuilder-operator && cd kubebuilder-operator
$ kubebuilder init --domain k8s.io --license apache2 --owner "The JOnTheBeach
Audience"
$ kubebuilder create api --group ships --version v1beta1 --kind Sloop
$ # Edit the logic code
$ pkg/controller/sloop/sloop_controller.go
An Intro to Kubernetes Operators - Lili Cosic29
operator-sdk
An Intro to Kubernetes Operators - Lili Cosic30
operator-sdk
● github.com/operator-framework/operator-sdk
● Aimed at creating operators
● Part of operator-framework
● Operator types you can create:
○ go
○ helm
○ ansible
● Testing framework
An Intro to Kubernetes Operators - Lili Cosic31
Using operator-sdk
Example of a go operator
$ operator-sdk new app-operator
$ cd app-operator
$ # Add a new API for the custom resource AppService
$ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
$ # Add a new controller that watches for AppService
$ operator-sdk add controller --api-version=app.example.com/v1alpha1 --kind=AppService
$ # Build operator
$ operator-sdk build quay.io/example/app-operator
An Intro to Kubernetes Operators - Lili Cosic32
operator-sdk - helm
An Intro to Kubernetes Operators - Lili Cosic33
Using operator-sdk
Example of a helm operator
$ # Create a new helm operator project
$ operator-sdk new nginx-operator --api-version=example.com/v1alpha1 --kind=Nginx --type=helm
$ # Edit watches.yaml file to customize the operator logic
An Intro to Kubernetes Operators - Lili Cosic34
operator-sdk - ansible
An Intro to Kubernetes Operators - Lili Cosic35
Using operator-sdk
Example of an ansible operator
$ # Create a new ansible based operator project:
$ operator-sdk new memcached-operator --api-version=cache.example.com/v1alpha1
--kind=Memcached --type=ansible
$ # Edit watches file to customize the logic
An Intro to Kubernetes Operators - Lili Cosic36
Deploying an operator
An Intro to Kubernetes Operators - Lili Cosic37
Deploying (operator) on Kubernetes
● YAML
● Kustomize
● Jsonnet
● OLM
● Helm
An Intro to Kubernetes Operators - Lili Cosic38
YAML
$ # Register the CRD
$ kubectl apply -f crd.yaml
$ # Create any needed Role Based Access Control
$ kubectl apply -f rbac.yaml
$ # Deploy the operator
$ kubectl apply -f deploy.yaml
$ # Create an instance
$ kubectl apply -f cr.yaml
An Intro to Kubernetes Operators - Lili Cosic39
YAML - CRD manifest file
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: memcacheds.cache.example.com
spec:
group: cache.example.com
names:
kind: Memcached
listKind: MemcachedList
plural: memcacheds
singular: memcached
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
size:
format: int32
type: integer
required:
- size
type: object
status:
properties:
nodes:
items:
type: string
type: array
required:
- nodes
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
An Intro to Kubernetes Operators - Lili Cosic40
YAML - deployment manifest file
apiVersion: apps/v1
kind: Deployment
metadata:
name: memcached-operator
spec:
replicas: 1
selector:
matchLabels:
name: memcached-operator
template:
metadata:
labels:
name: memcached-operator
spec:
serviceAccountName: memcached-operator
containers:
- name: memcached-operator
image: memached:123
command:
- memcached-operator
imagePullPolicy: Always
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: "memcached-operator"
An Intro to Kubernetes Operators - Lili Cosic41
YAML - CR instance manifest file
apiVersion: cache.example.com/v1alpha1
kind: Memcached
metadata:
name: example-memcached
spec:
size: 3
An Intro to Kubernetes Operators - Lili Cosic42
OLM
● Upgrades
● Descriptions and metadata
● Dependency resolution
● Multiple versions of operator to install
Key features
An Intro to Kubernetes Operators - Lili Cosic43
Debugging an operator
An Intro to Kubernetes Operators - Lili Cosic44
Debugging an operator
● `operator-sdk up local` - run
● Log all the things!
● Get logs of an operator
○ `kubectl logs <pod-name>`
● Use CR name to label any pods the operator creates
● `kubectl events -n NAMESPACE`
● `Spec.Paused`
An Intro to Kubernetes Operators - Lili Cosic45
Kubernetes cluster stack for big data
An Intro to Kubernetes Operators - Lili Cosic46
More information
● Kubernetes Special Interest Group Big Data
● User group meeting: Wednesdays at 18:00 UTC (biweekly)
● Slack channel - #ug-big-data
An Intro to Kubernetes Operators - Lili Cosic47
Spark operator
Spark on Kubernetes
github.com/GoogleCloudPlatform/spark-on-k8s-operator
An Intro to Kubernetes Operators - Lili Cosic48
Future
Whats next for operators?
● OLM
● cluster-addons
● CRDs
○ GA in 1.16
QUESTIONS
Lili Cosic
Twitter: @LiliCosic
Github: lilic

More Related Content

What's hot

Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
CloudOps2005
 
Introduction to helm
Introduction to helmIntroduction to helm
Introduction to helm
Jeeva Chelladhurai
 
Introduction to Helm
Introduction to HelmIntroduction to Helm
Introduction to Helm
Harshal Shah
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
CJ Cullen
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
Gabriel Carro
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
Bob Killen
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
Megan O'Keefe
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
Eric Gustafson
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
Phuc Nguyen
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
Rishabh Kumar
 
Secrets in Kubernetes
Secrets in KubernetesSecrets in Kubernetes
Secrets in Kubernetes
Jerry Jalava
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
Bytemark
 
Intro to Helm for Kubernetes
Intro to Helm for KubernetesIntro to Helm for Kubernetes
Intro to Helm for Kubernetes
Carlos E. Salazar
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to Kubernetes
Ronny Trommer
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
Crevise Technologies
 
Introduction of Kubernetes - Trang Nguyen
Introduction of Kubernetes - Trang NguyenIntroduction of Kubernetes - Trang Nguyen
Introduction of Kubernetes - Trang Nguyen
Trang Nguyen
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
Eueung Mulyana
 
Intro to kubernetes
Intro to kubernetesIntro to kubernetes
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
sparkfabrik
 
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShiftKubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
DevOps.com
 

What's hot (20)

Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
 
Introduction to helm
Introduction to helmIntroduction to helm
Introduction to helm
 
Introduction to Helm
Introduction to HelmIntroduction to Helm
Introduction to Helm
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Secrets in Kubernetes
Secrets in KubernetesSecrets in Kubernetes
Secrets in Kubernetes
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 
Intro to Helm for Kubernetes
Intro to Helm for KubernetesIntro to Helm for Kubernetes
Intro to Helm for Kubernetes
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to Kubernetes
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Introduction of Kubernetes - Trang Nguyen
Introduction of Kubernetes - Trang NguyenIntroduction of Kubernetes - Trang Nguyen
Introduction of Kubernetes - Trang Nguyen
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Intro to kubernetes
Intro to kubernetesIntro to kubernetes
Intro to kubernetes
 
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastrutturaGitOps: Git come unica fonte di verità per applicazioni e infrastruttura
GitOps: Git come unica fonte di verità per applicazioni e infrastruttura
 
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShiftKubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
 

Similar to An intro to Kubernetes operators

K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
Piotr Perzyna
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetes
Bob Killen
 
Docker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker eeDocker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker ee
Docker, Inc.
 
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
VMUG IT
 
Exploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in PythonExploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in Python
Ivan Ma
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
Bob Killen
 
Continuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIContinuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CI
alexanderkiel
 
Kubernetes Administration from Zero to Hero.pdf
Kubernetes Administration from Zero to Hero.pdfKubernetes Administration from Zero to Hero.pdf
Kubernetes Administration from Zero to Hero.pdf
ArzooGupta16
 
Docker kubernetes fundamental(pod_service)_190307
Docker kubernetes fundamental(pod_service)_190307Docker kubernetes fundamental(pod_service)_190307
Docker kubernetes fundamental(pod_service)_190307
Inhye Park
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
Ambassador Labs
 
Kubernetes extensibility
Kubernetes extensibilityKubernetes extensibility
Kubernetes extensibility
Docker, Inc.
 
The App Developer's Kubernetes Toolbox
The App Developer's Kubernetes ToolboxThe App Developer's Kubernetes Toolbox
The App Developer's Kubernetes Toolbox
Nebulaworks
 
ОЛЕГ МАЦЬКІВ «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
UA DevOps Conference
 
Operator Lifecycle Management
Operator Lifecycle ManagementOperator Lifecycle Management
Operator Lifecycle Management
DoKC
 
Operator Lifecycle Management
Operator Lifecycle ManagementOperator Lifecycle Management
Operator Lifecycle Management
DoKC
 
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
Athens Big Data
 
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
Amir Moghimi
 
Fabio rapposelli pks-vmug
Fabio rapposelli   pks-vmugFabio rapposelli   pks-vmug
Fabio rapposelli pks-vmug
VMUG IT
 
Delivering-Off-The-Shelf Software with Kubernetes- November 12, 2020
Delivering-Off-The-Shelf Software with Kubernetes- November 12, 2020Delivering-Off-The-Shelf Software with Kubernetes- November 12, 2020
Delivering-Off-The-Shelf Software with Kubernetes- November 12, 2020
VMware Tanzu
 
Building Cloud-Native Applications with Kubernetes, Helm and Kubeless
Building Cloud-Native Applications with Kubernetes, Helm and KubelessBuilding Cloud-Native Applications with Kubernetes, Helm and Kubeless
Building Cloud-Native Applications with Kubernetes, Helm and Kubeless
Bitnami
 

Similar to An intro to Kubernetes operators (20)

K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetes
 
Docker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker eeDocker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker ee
 
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
 
Exploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in PythonExploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in Python
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Continuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CIContinuous Deployment with Kubernetes, Docker and GitLab CI
Continuous Deployment with Kubernetes, Docker and GitLab CI
 
Kubernetes Administration from Zero to Hero.pdf
Kubernetes Administration from Zero to Hero.pdfKubernetes Administration from Zero to Hero.pdf
Kubernetes Administration from Zero to Hero.pdf
 
Docker kubernetes fundamental(pod_service)_190307
Docker kubernetes fundamental(pod_service)_190307Docker kubernetes fundamental(pod_service)_190307
Docker kubernetes fundamental(pod_service)_190307
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
 
Kubernetes extensibility
Kubernetes extensibilityKubernetes extensibility
Kubernetes extensibility
 
The App Developer's Kubernetes Toolbox
The App Developer's Kubernetes ToolboxThe App Developer's Kubernetes Toolbox
The App Developer's Kubernetes Toolbox
 
ОЛЕГ МАЦЬКІВ «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
 
Operator Lifecycle Management
Operator Lifecycle ManagementOperator Lifecycle Management
Operator Lifecycle Management
 
Operator Lifecycle Management
Operator Lifecycle ManagementOperator Lifecycle Management
Operator Lifecycle Management
 
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
 
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
 
Fabio rapposelli pks-vmug
Fabio rapposelli   pks-vmugFabio rapposelli   pks-vmug
Fabio rapposelli pks-vmug
 
Delivering-Off-The-Shelf Software with Kubernetes- November 12, 2020
Delivering-Off-The-Shelf Software with Kubernetes- November 12, 2020Delivering-Off-The-Shelf Software with Kubernetes- November 12, 2020
Delivering-Off-The-Shelf Software with Kubernetes- November 12, 2020
 
Building Cloud-Native Applications with Kubernetes, Helm and Kubeless
Building Cloud-Native Applications with Kubernetes, Helm and KubelessBuilding Cloud-Native Applications with Kubernetes, Helm and Kubeless
Building Cloud-Native Applications with Kubernetes, Helm and Kubeless
 

More from J On The Beach

Massively scalable ETL in real world applications: the hard way
Massively scalable ETL in real world applications: the hard wayMassively scalable ETL in real world applications: the hard way
Massively scalable ETL in real world applications: the hard way
J On The Beach
 
Big Data On Data You Don’t Have
Big Data On Data You Don’t HaveBig Data On Data You Don’t Have
Big Data On Data You Don’t Have
J On The Beach
 
Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...
Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...
Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...
J On The Beach
 
Pushing it to the edge in IoT
Pushing it to the edge in IoTPushing it to the edge in IoT
Pushing it to the edge in IoT
J On The Beach
 
Drinking from the firehose, with virtual streams and virtual actors
Drinking from the firehose, with virtual streams and virtual actorsDrinking from the firehose, with virtual streams and virtual actors
Drinking from the firehose, with virtual streams and virtual actors
J On The Beach
 
How do we deploy? From Punched cards to Immutable server pattern
How do we deploy? From Punched cards to Immutable server patternHow do we deploy? From Punched cards to Immutable server pattern
How do we deploy? From Punched cards to Immutable server pattern
J On The Beach
 
Java, Turbocharged
Java, TurbochargedJava, Turbocharged
Java, Turbocharged
J On The Beach
 
When Cloud Native meets the Financial Sector
When Cloud Native meets the Financial SectorWhen Cloud Native meets the Financial Sector
When Cloud Native meets the Financial Sector
J On The Beach
 
The big data Universe. Literally.
The big data Universe. Literally.The big data Universe. Literally.
The big data Universe. Literally.
J On The Beach
 
Streaming to a New Jakarta EE
Streaming to a New Jakarta EEStreaming to a New Jakarta EE
Streaming to a New Jakarta EE
J On The Beach
 
The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...
The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...
The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...
J On The Beach
 
Pushing AI to the Client with WebAssembly and Blazor
Pushing AI to the Client with WebAssembly and BlazorPushing AI to the Client with WebAssembly and Blazor
Pushing AI to the Client with WebAssembly and Blazor
J On The Beach
 
Axon Server went RAFTing
Axon Server went RAFTingAxon Server went RAFTing
Axon Server went RAFTing
J On The Beach
 
The Six Pitfalls of building a Microservices Architecture (and how to avoid t...
The Six Pitfalls of building a Microservices Architecture (and how to avoid t...The Six Pitfalls of building a Microservices Architecture (and how to avoid t...
The Six Pitfalls of building a Microservices Architecture (and how to avoid t...
J On The Beach
 
Madaari : Ordering For The Monkeys
Madaari : Ordering For The MonkeysMadaari : Ordering For The Monkeys
Madaari : Ordering For The Monkeys
J On The Beach
 
Servers are doomed to fail
Servers are doomed to failServers are doomed to fail
Servers are doomed to fail
J On The Beach
 
Interaction Protocols: It's all about good manners
Interaction Protocols: It's all about good mannersInteraction Protocols: It's all about good manners
Interaction Protocols: It's all about good manners
J On The Beach
 
A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...
A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...
A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...
J On The Beach
 
Leadership at every level
Leadership at every levelLeadership at every level
Leadership at every level
J On The Beach
 
Machine Learning: The Bare Math Behind Libraries
Machine Learning: The Bare Math Behind LibrariesMachine Learning: The Bare Math Behind Libraries
Machine Learning: The Bare Math Behind Libraries
J On The Beach
 

More from J On The Beach (20)

Massively scalable ETL in real world applications: the hard way
Massively scalable ETL in real world applications: the hard wayMassively scalable ETL in real world applications: the hard way
Massively scalable ETL in real world applications: the hard way
 
Big Data On Data You Don’t Have
Big Data On Data You Don’t HaveBig Data On Data You Don’t Have
Big Data On Data You Don’t Have
 
Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...
Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...
Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...
 
Pushing it to the edge in IoT
Pushing it to the edge in IoTPushing it to the edge in IoT
Pushing it to the edge in IoT
 
Drinking from the firehose, with virtual streams and virtual actors
Drinking from the firehose, with virtual streams and virtual actorsDrinking from the firehose, with virtual streams and virtual actors
Drinking from the firehose, with virtual streams and virtual actors
 
How do we deploy? From Punched cards to Immutable server pattern
How do we deploy? From Punched cards to Immutable server patternHow do we deploy? From Punched cards to Immutable server pattern
How do we deploy? From Punched cards to Immutable server pattern
 
Java, Turbocharged
Java, TurbochargedJava, Turbocharged
Java, Turbocharged
 
When Cloud Native meets the Financial Sector
When Cloud Native meets the Financial SectorWhen Cloud Native meets the Financial Sector
When Cloud Native meets the Financial Sector
 
The big data Universe. Literally.
The big data Universe. Literally.The big data Universe. Literally.
The big data Universe. Literally.
 
Streaming to a New Jakarta EE
Streaming to a New Jakarta EEStreaming to a New Jakarta EE
Streaming to a New Jakarta EE
 
The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...
The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...
The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...
 
Pushing AI to the Client with WebAssembly and Blazor
Pushing AI to the Client with WebAssembly and BlazorPushing AI to the Client with WebAssembly and Blazor
Pushing AI to the Client with WebAssembly and Blazor
 
Axon Server went RAFTing
Axon Server went RAFTingAxon Server went RAFTing
Axon Server went RAFTing
 
The Six Pitfalls of building a Microservices Architecture (and how to avoid t...
The Six Pitfalls of building a Microservices Architecture (and how to avoid t...The Six Pitfalls of building a Microservices Architecture (and how to avoid t...
The Six Pitfalls of building a Microservices Architecture (and how to avoid t...
 
Madaari : Ordering For The Monkeys
Madaari : Ordering For The MonkeysMadaari : Ordering For The Monkeys
Madaari : Ordering For The Monkeys
 
Servers are doomed to fail
Servers are doomed to failServers are doomed to fail
Servers are doomed to fail
 
Interaction Protocols: It's all about good manners
Interaction Protocols: It's all about good mannersInteraction Protocols: It's all about good manners
Interaction Protocols: It's all about good manners
 
A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...
A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...
A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...
 
Leadership at every level
Leadership at every levelLeadership at every level
Leadership at every level
 
Machine Learning: The Bare Math Behind Libraries
Machine Learning: The Bare Math Behind LibrariesMachine Learning: The Bare Math Behind Libraries
Machine Learning: The Bare Math Behind Libraries
 

Recently uploaded

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 

Recently uploaded (20)

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 

An intro to Kubernetes operators

  • 1. An intro to Kubernetes operators Lili Cosic Software Engineer at Red Hat Twitter: @LiliCosic Github: lilic
  • 2. An Intro to Kubernetes Operators - Lili Cosic2 Intro to Kubernetes
  • 3. An Intro to Kubernetes Operators - Lili Cosic3 Kubernetes What is Kubernetes? ● Open source platform for managing containerized workloads and services ● Containers, containers, containers ● Name originates from Greek - helmsman or pilot ● Google open-sourced in 2014 ● Based on Borg - Google’ internal project ● K_ _ _ _ _ _ _ _S -> k8s
  • 4. An Intro to Kubernetes Operators - Lili Cosic4 Kubernetes What is great about Kubernetes? ● Scalability of workloads ● Separation of workloads ● Native stable resources (Deployments, Pods) ● API / Custom Resources
  • 5. An Intro to Kubernetes Operators - Lili Cosic5 Kubernetes What is Kubernetes not? ● Not a PaaS ● Not limited to the types of apps supported ● Not opinionated on: ○ Deploying ○ Run CI/CD ○ Logging, monitoring or alerting
  • 6. An Intro to Kubernetes Operators - Lili Cosic6 Kubernetes controllers
  • 7. An Intro to Kubernetes Operators - Lili Cosic7 What is a controller? ● Reconciles given state ● Controller pattern ○ Non terminating loop that regulates the state of the system ○ A control loop that watches the shared state of the cluster via the API server and makes changes to move from current to desired state
  • 8. An Intro to Kubernetes Operators - Lili Cosic8 ReplicaSet controller Example controller ● ReplicaSet ○ Created by a Deployments ○ Creates Pods ● Reconciles to the correct (specified) number of pods running the cluster
  • 9. An Intro to Kubernetes Operators - Lili Cosic9 Controller Credit: github.com/kubernetes/sample-controller
  • 10. An Intro to Kubernetes Operators - Lili Cosic10 Informer pattern More important API functions ● ListWatcher ○ Helps you filter resources you want to watch ● ResourceEventHandler ○ Add, Update and Delete event trigger functions
  • 11. An Intro to Kubernetes Operators - Lili Cosic11 Workqueue? ● Resource Event Handler puts an item to the workqueue ● Workqueue consists of keys: ○ <resource_namespace>/<resource_name> ● Only one worker works on one item at a time ● First In First Out
  • 12. An Intro to Kubernetes Operators - Lili Cosic12 CRD - Custom Resource Definition
  • 13. An Intro to Kubernetes Operators - Lili Cosic13 CRD - custom resource definition apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the form: <plural>.<group> name: crontabs.stable.example.com spec: # group name to use for REST API: /apis/<group>/<version> group: stable.example.com # 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 # either Namespaced or Cluster scope: Namespaced names: # plural name to be used in the URL: /apis/<group>/<version>/<plural> plural: crontabs # singular name to be used as an alias on the CLI and for display singular: crontab # kind is normally the CamelCased singular type. Your resource manifests use this. kind: CronTab # shortNames allow shorter string to match your resource on the CLI shortNames: - ct
  • 14. An Intro to Kubernetes Operators - Lili Cosic14 Operators, operators, operators
  • 15. An Intro to Kubernetes Operators - Lili Cosic15
  • 16. An Intro to Kubernetes Operators - Lili Cosic16 What is an “operator”? Operator is a K8s controller - specific to operating an application
  • 17. An Intro to Kubernetes Operators - Lili Cosic17 What is an “operator”? ● Non core Kubernetes controller ● Makes use of CRDs - custom resource definition ● Holds the knowledge of how an application needs to be deployed, managed and packaged ● Reconcile loop ● Extends the Kubernetes API to make the application a custom resource - part of the Kubernetes ecosystem ● Concept introduced by CoreOS
  • 18. An Intro to Kubernetes Operators - Lili Cosic18 Good examples of operators Awesome operators! ● github.com/coreos/prometheus-operator ● github.com/zalando-incubator/postgres-operator ● github.com/coreos/etcd-operator
  • 19. An Intro to Kubernetes Operators - Lili Cosic19 When to choose creating an operator? ● Application uses declarative API ● Resources are scoped to a namespace or a cluster ● Encapsulate business logic ● Build automation that watches for updates of Kubernetes objects ● Create or update resources via the Kubernetes native API ● Top level support from kubectl
  • 20. An Intro to Kubernetes Operators - Lili Cosic20 When to just use a ConfigMap or Secret? Sometimes creating an operator is not needed ● Existing well known config file format (e.g. mysql.cnf ) ● Config file is used to just configure an application running in a Pod ● No need to reconcile to the state
  • 21. An Intro to Kubernetes Operators - Lili Cosic21 101 ways to build an operator ● go language: ○ client-go & co. ○ operator-sdk ○ kubebuilder ● Other languages: ○ Kubernetes python and java clients and others ● Other tools: ○ helm ○ ansible
  • 22. An Intro to Kubernetes Operators - Lili Cosic22 Building operators using Kubernetes native clients
  • 23. An Intro to Kubernetes Operators - Lili Cosic23 Kubernetes native clients ● k8s.io/client-go ○ rest ○ discovery ○ dynamic ● k8s.io/api ● ks8.io/apimachinery
  • 24. An Intro to Kubernetes Operators - Lili Cosic24 Kubernetes native clients Pros ● Same as upstream controllers use ● Stability of K8s code ● Versioning based on Kubernetes releases ● Ability to finetune Cons ● Large ecosystem ● No abstractions/helpers ● A lot of inside knowledge to optimize correctly ● New major version on every Kubernetes minor version release
  • 25. An Intro to Kubernetes Operators - Lili Cosic25 Using Kubernetes native go clients Example of an “operator” github.com/kubernetes/sample-controller
  • 26. An Intro to Kubernetes Operators - Lili Cosic26 kubebuilder
  • 27. An Intro to Kubernetes Operators - Lili Cosic27 kubebuilder ● github.com/kubernetes-sigs/kubebuilder ● SDK for building Kubernetes APIs using CRDs ● Part of kubernetes-sigs repo ● Uses controller-runtime under the hood ● Doesn’t strictly advertise itself as operator builder tool
  • 28. An Intro to Kubernetes Operators - Lili Cosic28 Using kubebuilder Example of a go operator $ mkdir kubebuilder-operator && cd kubebuilder-operator $ kubebuilder init --domain k8s.io --license apache2 --owner "The JOnTheBeach Audience" $ kubebuilder create api --group ships --version v1beta1 --kind Sloop $ # Edit the logic code $ pkg/controller/sloop/sloop_controller.go
  • 29. An Intro to Kubernetes Operators - Lili Cosic29 operator-sdk
  • 30. An Intro to Kubernetes Operators - Lili Cosic30 operator-sdk ● github.com/operator-framework/operator-sdk ● Aimed at creating operators ● Part of operator-framework ● Operator types you can create: ○ go ○ helm ○ ansible ● Testing framework
  • 31. An Intro to Kubernetes Operators - Lili Cosic31 Using operator-sdk Example of a go operator $ operator-sdk new app-operator $ cd app-operator $ # Add a new API for the custom resource AppService $ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService $ # Add a new controller that watches for AppService $ operator-sdk add controller --api-version=app.example.com/v1alpha1 --kind=AppService $ # Build operator $ operator-sdk build quay.io/example/app-operator
  • 32. An Intro to Kubernetes Operators - Lili Cosic32 operator-sdk - helm
  • 33. An Intro to Kubernetes Operators - Lili Cosic33 Using operator-sdk Example of a helm operator $ # Create a new helm operator project $ operator-sdk new nginx-operator --api-version=example.com/v1alpha1 --kind=Nginx --type=helm $ # Edit watches.yaml file to customize the operator logic
  • 34. An Intro to Kubernetes Operators - Lili Cosic34 operator-sdk - ansible
  • 35. An Intro to Kubernetes Operators - Lili Cosic35 Using operator-sdk Example of an ansible operator $ # Create a new ansible based operator project: $ operator-sdk new memcached-operator --api-version=cache.example.com/v1alpha1 --kind=Memcached --type=ansible $ # Edit watches file to customize the logic
  • 36. An Intro to Kubernetes Operators - Lili Cosic36 Deploying an operator
  • 37. An Intro to Kubernetes Operators - Lili Cosic37 Deploying (operator) on Kubernetes ● YAML ● Kustomize ● Jsonnet ● OLM ● Helm
  • 38. An Intro to Kubernetes Operators - Lili Cosic38 YAML $ # Register the CRD $ kubectl apply -f crd.yaml $ # Create any needed Role Based Access Control $ kubectl apply -f rbac.yaml $ # Deploy the operator $ kubectl apply -f deploy.yaml $ # Create an instance $ kubectl apply -f cr.yaml
  • 39. An Intro to Kubernetes Operators - Lili Cosic39 YAML - CRD manifest file apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: memcacheds.cache.example.com spec: group: cache.example.com names: kind: Memcached listKind: MemcachedList plural: memcacheds singular: memcached scope: Namespaced subresources: status: {} validation: openAPIV3Schema: properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' type: string kind: description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' type: string metadata: type: object spec: properties: size: format: int32 type: integer required: - size type: object status: properties: nodes: items: type: string type: array required: - nodes type: object version: v1alpha1 versions: - name: v1alpha1 served: true storage: true
  • 40. An Intro to Kubernetes Operators - Lili Cosic40 YAML - deployment manifest file apiVersion: apps/v1 kind: Deployment metadata: name: memcached-operator spec: replicas: 1 selector: matchLabels: name: memcached-operator template: metadata: labels: name: memcached-operator spec: serviceAccountName: memcached-operator containers: - name: memcached-operator image: memached:123 command: - memcached-operator imagePullPolicy: Always env: - name: WATCH_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: OPERATOR_NAME value: "memcached-operator"
  • 41. An Intro to Kubernetes Operators - Lili Cosic41 YAML - CR instance manifest file apiVersion: cache.example.com/v1alpha1 kind: Memcached metadata: name: example-memcached spec: size: 3
  • 42. An Intro to Kubernetes Operators - Lili Cosic42 OLM ● Upgrades ● Descriptions and metadata ● Dependency resolution ● Multiple versions of operator to install Key features
  • 43. An Intro to Kubernetes Operators - Lili Cosic43 Debugging an operator
  • 44. An Intro to Kubernetes Operators - Lili Cosic44 Debugging an operator ● `operator-sdk up local` - run ● Log all the things! ● Get logs of an operator ○ `kubectl logs <pod-name>` ● Use CR name to label any pods the operator creates ● `kubectl events -n NAMESPACE` ● `Spec.Paused`
  • 45. An Intro to Kubernetes Operators - Lili Cosic45 Kubernetes cluster stack for big data
  • 46. An Intro to Kubernetes Operators - Lili Cosic46 More information ● Kubernetes Special Interest Group Big Data ● User group meeting: Wednesdays at 18:00 UTC (biweekly) ● Slack channel - #ug-big-data
  • 47. An Intro to Kubernetes Operators - Lili Cosic47 Spark operator Spark on Kubernetes github.com/GoogleCloudPlatform/spark-on-k8s-operator
  • 48. An Intro to Kubernetes Operators - Lili Cosic48 Future Whats next for operators? ● OLM ● cluster-addons ● CRDs ○ GA in 1.16