Kubernetes operators are a way to create, configure, and manage complex applications on top of Kubernetes. Our previous article explained operators—how they came about and when and why they're useful. In this article, we'll show you how to create your own operator.
[ Learn the basics in the Kubernetes cheat sheet. ]
Create your own operator
Although the learning curve can be steep, there are tools and communities that make getting started straightforward. Operator Framework is an open source toolkit that manages Kubernetes operators in an effective, automated, and scalable way. It consists of three major toolsets: Operator SDK, Operator Lifecycle Manager (OLM), and OperatorHub.io.

Operator SDK
Operator SDK provides tools to build, test, and package operators. The framework uses the controller-runtime library to make writing operators easier by providing high-level APIs to write operational logic intuitively, tools for scaffolding and code generation to bootstrap a new project quickly, and extensions to cover common operator use cases.
To install Operator SDK, clone the source code and then compile:
$ git clone https://github.com/operator-framework/operator-sdk
$ cd operator-sdk
$ git checkout master
$ make install
[ Get this complimentary eBook from Red Hat: Managing your Kubernetes clusters for dummies. ]
Operator Lifecycle Manager (OLM)
OLM extends Kubernetes to provide a declarative way to install, manage, and upgrade operators on a cluster. OLM includes over-the-air updates and catalogs that keep operators up to date automatically. It has a dependency model that allows operators to express dependencies on the platform and on other operators. OLM makes operators and their services available for cluster users to select and install. It provides cluster stability by preventing conflicting operators from owning the same APIs.
OLM Architecture

- olm-operator
- catalog-operator
These operators manage the CRDs that are the basis of the OLM framework. The CRDs managed by olm-operator and catalog-operator are:
- ClusterServiceVersion
- InstallPlan
- CatalogSource
- Subscription
- OperatorGroup
OLM Operator
OLM Operator deploys the applications defined by a ClusterServiceVersion (CSV) after the required resources specified in the CSV are in the cluster.
A CSV is a YAML manifest created from operator metadata that assists OLM in running the operator in a cluster. Since the OLM Operator is not concerned with creating the resources, a user can choose to either create these resources manually using the command-line interface (CLI) or opt to use Catalog Operator to create them.
OLM Operator is configured in such a way that it watches all namespaces. It watches for a CSV and checks that all requirements are met. If so, it runs the install strategy for the CSV.
Catalog Operator
The Catalog Operator resolves and installs CSVs and the resources they require. Catalog Operator watches for CatalogSource and Subscriptions and creates InstallPlans based on them.
- CatalogSource is the collection of metadata defined in CSV.
- Subscriptions describe which channel of an Operator package to subscribe to and whether to perform updates automatically or manually. They also define the operator's name and namespace.
Catalog Operator also watches for resolved and unresolved InstallPlans created by the user and creates all the discovered resources for them.
[ Getting started with containers? Check out Deploying containerized applications: A technical overview. ]
OperatorHub.io
OperatorHub.io is a home for the Kubernetes community to share operators. It was launched and created by Red Hat with Amazon, Microsoft, and Google as initial supporters. OperatorHub.io aims to be the central location where users can find a wide array of community-built operators.
The OperatorHub.io library was made for both operator developers and end users. It provides developers a place to publish and update their work and defines criteria and requirements for publication. Operators on OperatorHub.io are standardized to provide end users with basic documentation and easy access to deploy and manage operators from their own Kubernetes cluster.
OperatorHub.io is the frontend for the Community Operator Repository on GitHub, so to get an operator published to OperatorHub.io, developers need only to package their operator via OLM and submit a pull request to the repository to have it reviewed. For more information on how you can contribute, check out the OperatorHub.io contribution page.
Where does OpenShift Container Platform fit in?

RedHat OpenShift Container Platform (RHOCP) is a consistent hybrid cloud foundation for building and scaling containerized applications. This platform helps developers build applications offering automated installation, upgrades, and lifecycle management throughout the container stack. It uses microservices-based architecture with smaller, decoupled units that work together.
The Red Hat Openshift Container Platform runs the Red Hat Enterprise Linux (RHEL) operating system and functions as a set of Docker-based application containers managed with Kubernetes orchestration. This platform is mainly used in hybrid cloud scenarios.
[ Learn the difference between Red Hat OpenShift and Kubernetes. ]
Scaffolding your own operator
The official Operator Framework tutorial gets you set up to create your own operator. Like most of the framework, it's easier than you might expect:
$ mkdir -p $HOME/projects/memcached-operator
$ cd $HOME/projects/memcached-operator
$ operator-sdk init --domain example.com \
--repo github.com/example/memcached-operator
$ operator-sdk create api --group cache --version v1alpha1 \
--kind Memcached --resource --controller
The Operator Framework helps you manage your Kubernetes and cloud operators. It lets you automate the vital tasks required to keep your cloud healthy, it's easy to learn, and simple to use. Install the Operator Framework and try it today.
About the authors
I'm a 23-year-old international professional working as a Software Engineer at RedHat in the Operator Enablement Team. My team works on OpenShift, Kubernetes, and Operators, helping partners build their Kubernetes Operators and conducting various operator development workshops. After my undergrad, I worked on creating various web applications to get some hands-on experience. I have expertise in different frontend technologies and developed a few projects on Azure. Now I'm learning and exploring a new domain i.e. operator development. I have a knack for learning the latest technologies and implementing them. Also, I'm enthusiastic about becoming a part of various learning groups and ultimately teaching peers.
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit