installed
configured managed
upgraded
Running apps in Kubernetes is
easy
Kubernetes is a declarative
platform
$ oc scale deploy/web --replicas=3
Running them over time is
harder
⏣ Resize/Upgrade
⏣ Reconfigure
⏣ Backup
⏣ Healing
“Anything that isn’t automated
is slowing you down”
If only Kubernetes knew...
WHAT IS AN OPERATOR?
Grant Drop Database
WHAT IS AN OPERATOR?
WHAT IS AN OPERATOR?
Operators are automated
software managers that
manage the entire lifecycle of
Kubernetes applications
WHAT IS AN OPERATOR?
Value of Operators
Improve the “time to
first value” for your
customers
Minimize software upgrade
risk and associated
operational costs
Embed best practices
from the experts – you –
into the Operator
Provide a cloud-like "As
a Service" experience
HOW DOES AN OPERATOR WORK?
Custom Kubernetes Controller
Watch Events
Reconciliation
+
Custom Resource Definition
Kubernetes Operator
Custom Resource
Developer /
OpenShift User
HOW DOES AN OPERATOR WORK?
K8s API
kind: ProductionReadyDatabase
apiVersion:
database.example.com/v1alpha1
metadata:
name: my-important-database
spec:
connectionPoolSize: 300
readReplicas: 2
version: v4.0.1
Custom Kubernetes Controller
Watch Events
Reconciliation
+
Custom Resource Definition
Kubernetes Operator
● Operator SDK - Allows developers to build, package and test an Operator based on
your expertise without requiring all the knowledge of Kubernetes API complexities
● Operator Lifecycle Manager - Helps you to install, and update, and generally manage
the lifecycle of all of the Operators (and their associated services) running across
your clusters
● Operator Metering - Enable usage reporting for Operators and resources within
Kubernetes
CATEGORIES OF OPERATORS
Ansible SDKHelm SDK Go SDK
Helm Chart
Ansible Playbooks
APBs
Build operators from
Helm chart, without any
coding
Build operators from
Ansible playbooks and
APBs
Build advanced operators
for full lifecycle
management
TYPES OF OPERATORS
CAPABILITY LEVELS FOR OPERATORS
How does it all work?
OPERATOR PROJECT SCAFFOLD AND IMPLEMENTATION
OPERATOR
SDK
KUBERNETES
OPERATOR
+ =
AUTHOR
“create new
operator”
scaffolding custom logic
OPERATOR
SDK
KUBERNETES
OPERATOR
+ = +
OPERATOR
LIFECYCLE
MANAGER
“create new
operator”
scaffolding custom logic metadata
package
“make available to”
“list packages”
OPERATOR PUBLISHING
PUBLISHER
ADMINISTRATOR
AUTHOR
YourOperator v1.1.2
Bundle
OPERATOR
LIFECYCLE MANAGER
Deployment
Role
ClusterRole
RoleBinding
ClusterRoleBinding
ServiceAccount
CustomResourceDefinition
OPERATOR LIFECYCLE MANAGER: The Operator Operator
OPERATOR
LIFECYCLE MANAGER
YourOperator v1.1.2
YourOperator v1.1.3
YourOperator v1.2.0
YourOperator v1.2.2
Subscription for
YourOperator
Time
VersionOperator Catalog
OPERATOR LIFECYCLE MANAGEMENT
Red Hat Products
ISV Partners
Community
OPERATOR HUB
Operator Hub - Allows
administrators to
selectively make
operators available from
curated sources to users
in the cluster.
...and many more
OPERATORS ACROSS THE INDUSTRY
OPERATOR
SDK
KUBERNETES
OPERATOR
+ = +
OPERATOR
LIFECYCLE
MANAGER
+
USER
“create new
operator”
scaffolding custom logic metadata
package
“make available to”
“list packages”
“subscribe to
channel”
subscriptionnamespaceoperator
instance
managed
application
“Create
application”
SERVICE INSTANTIATION
PUBLISHER
ADMINISTRATOR
+
AUTHOR
of Operator-backed Services
Reduce friction for deploying operator
backed applications
●
BASIC OPERATOR BEST PRACTICES
● Follow best practices on Container images for running on OpenShift
● Don’t use root
● Use a supported base image (RHEL, UBI) as security in the base images is critical
● Provide meaningful status information when querying the CR’s state
● Support an update/upgrade path for your operator’s resources:
● Your Operator must understand past and future versions of your application in order to
seamlessly transition from one to another.
● Migrations always needs to be done for long lived application installs, eg. if you change
the format of a ConfigMap, the Operator needs to migrate that and keep it up to date.
● What next? After install, upgrade, basic management, monitor Golden Signals: Operator is an
SRE in software
Resources
● https://github.com/operator-framework/getting-started
● https://github.com/operator-framework/community-operators
● https://commons.openshift.org/sig/operators.html
● https://groups.google.com/forum/#!forum/operator-framework
● https://operatorhub.io
● https://learn.openshift.com/operatorframework
● Kubernetes Operators, Dobies and Wood, O’Reilly, 2020
○ Compliments of Red Hat here
Crafting Kubernetes Operators

Crafting Kubernetes Operators