Red Hat, in collaboration with Microsoft, Google Cloud, and Amazon Web Services, recently launched OperatorHub.io. OperatorHub.io is designed as a public registry for finding services backed by Kubernetes Operators.
Operators were first introduced by CoreOS in 2016, designed to be an application specific controller that extends the Kubernetes API to create, configure, and manage instances of applications on behalf of a Kubernetes user. Furthermore, Kubernetes users can benefit from operators to automate routines, complex tasks, updates, backups, scaling applications, and more.
Operators are a method of packaging, deploying and managing applications that are both deployed on Kubernetes and managed using the Kubernetes APIs, and kubectl tooling; these applications are known as Kubernetes application.
In order to help make it easier to build Kubernetes applications, Red Hat and Kubernetes open sourced the Operator Framework. The Operator Framework is a toolkit that provides:
- Operator SDK – enables developers to build operators based on their expertise without requiring knowledge of Kubernetes API complexities
- Operator Lifecycle Manager – oversees installation, updates, and management of the lifecycle of all of the operators running on a Kubernetes cluster
- Operator Metering – enables usage reporting for Operators that provide specialized services
The Operator SDK supports developing operators using a series of languages such as Go, Ansible or Helm. A basic workflow to build a Go operator should be:
- Create a new operator project using the SDK Command Line Interface(CLI)
- Define new resource APIs by adding Custom Resource Definitions(CRD)
- Define Controllers to watch and reconcile resources
- Write the reconciling logic for Controller using the SDK and controller-runtime APIs
- Use the SDK CLI to build and generate the operator deployment manifests
To learn more about writing an operator, users can explore the guides available for Go, Ansible and Helm. In addition, it is possible to explore a series of operators built using the Operator SDK on the operator-sdk-samples repo.
According to Aparna Sinha, group product mManager, Google Cloud, at Google Cloud they have invested in building and qualifying community developed operators and are excited to see that more than 40% of Google Kubernetes Engine (GKE) clusters are running stateful applications today.
According to Diane Mueller, director of community development at Red Hat, for an operator to be considered for inclusion in the OperatorHub.io, the operator must successfully show cluster lifecycle features, packaging that can be maintained through the Operator Framework’s Operator Lifecycle Management, and acceptable documentation for its intended users.
Some examples of Operators that are currently listed in OperatorHub.io include: Amazon Web Services Operator, Couchbase Autonomous Operator, CrunchyData’s PostgreSQL, etcd Operator, Jaeger Operator for Kubernetes, Kubernetes Federation Operator, MongoDB Enterprise Operator, Percona MySQL Operator, PlanetScale’s Vitess Operator, Prometheus Operator, and Redis Operator.
To submit an Operator, it is necessary to submit a PR to OperatorHub.io community operators repo in a new directory named with the name of the operator that has been submitted, within the community-operators/ directory:
$ ls community-operators/my-operator/ my-operator.v1.0.0.clusterserviceversion.yaml my-operator-crd1.crd.yaml my-operator-crd2.crd.yaml my-operator.package.yaml
It is important to notice that the directory name should match the name of the new operator in its package.yaml.
Each OperatorHub entry contains all of the Custom Resource Definitions (CRDs), access control rules, references to the container image needed to install and securely run your Operator, description of its features, and supported Kubernetes versions.
More details regarding the submission or update operators can be found on the contribution guide.