$ oc get csv
Operators are a method of packaging, deploying, and managing a Kubernetes application. You can create applications on OpenShift Container Platform using Operators that have been installed by a cluster administrator.
This guide walks developers through an example of creating applications from an installed Operator using the OpenShift Container Platform web console.
See the Operators guide for more on how Operators work and how the Operator Lifecycle Manager is integrated in OpenShift Container Platform.
This procedure walks through creating a new etcd cluster using the etcd Operator, managed by the Operator Lifecycle Manager (OLM).
Access to an OpenShift Container Platform 4.4 cluster.
The etcd Operator already installed cluster-wide by an administrator.
Create a new project in the OpenShift Container Platform web console for this procedure. This example uses a project called my-etcd.
Navigate to the Operators → Installed Operators page. The Operators that have been installed to the cluster by the cluster administrator and are available for use are shown here as a list of ClusterServiceVersions (CSVs). CSVs are used to launch and manage the software provided by the Operator.
You can get this list from the CLI using: $ oc get csv |
On the Installed Operators page, click Copied, and then click the etcd Operator to view more details and available actions:
As shown under Provided APIs, this Operator makes available three new resource
types, including one for an etcd Cluster (the etcdCluster
resource). These
objects work similar to the built-in native Kubernetes ones, such as
Deployments
or ReplicaSets
, but contain logic specific to managing etcd.
Create a new etcd cluster:
In the etcd Cluster API box, click Create New.
The next screen allows you to make any modifications to the minimal starting template of an etcdCluster
object, such as the size of the cluster. For now, click Create to finalize. This triggers the Operator to start up the pods, services, and other components of the new etcd cluster.
Click the Resources tab to see that your project now contains a number of resources created and configured automatically by the Operator.
Verify that a Kubernetes service has been created that allows you to access the database from other pods in your project.
All users with the edit
role in a given project can create, manage, and delete
application instances (an etcd cluster, in this example) managed by Operators
that have already been created in the project, in a self-service manner, just
like a cloud service. If you want to enable additional users with this ability,
project administrators can add the role using the following command:
$ oc policy add-role-to-user edit <user> -n <target_project>
You now have an etcd cluster that will react to failures and rebalance data as Pods become unhealthy or are migrated between nodes in the cluster. Most importantly, cluster administrators or developers with proper access can now easily use the database with their applications.