This guide walks cluster administrators through installing Operators to an OpenShift Container Platform cluster and subscribing Operators to namespaces.
As a cluster administrator, you can install an Operator from the OperatorHub using the OpenShift Container Platform web console or the CLI. You can then subscribe the Operator to one or more namespaces to make it available for developers on your cluster.
During installation, you must determine the following initial settings for the Operator:
Choose All namespaces on the cluster (default) to have the Operator installed on all namespaces or choose individual namespaces, if available, to only install the Operator on selected namespaces. This example chooses All namespaces… to make the Operator available to all users and projects.
If an Operator is available through multiple channels, you can choose which channel you want to subscribe to. For example, to deploy from the stable channel, if available, select it from the list.
You can choose Automatic or Manual updates. If you choose Automatic updates for an installed Operator, when a new version of that Operator is available, the Operator Lifecycle Manager (OLM) automatically upgrades the running instance of your Operator without human intervention. If you select Manual updates, when a newer version of an Operator is available, the OLM creates an update request. As a cluster administrator, you must then manually approve that update request to have the Operator updated to the new version.
This procedure uses the Couchbase Operator as an example to install and subscribe to an Operator from the OperatorHub using the OpenShift Container Platform web console.
Access to an OpenShift Container Platform cluster using an account with
cluster-admin
permissions.
Navigate in the web console to the Operators → OperatorHub page.
Scroll or type a keyword into the Filter by keyword box (in this case,
Couchbase
) to find the Operator you want.
Select the Operator. For a Community Operator, you are warned that Red Hat does not certify those Operators. You must acknowledge that warning before continuing. Information about the Operator is displayed.
Read the information about the Operator and click Install.
On the Create Operator Subscription page:
Select one of the following:
All namespaces on the cluster (default) installs the Operator in the default
openshift-operators
namespace to watch and be made available to all namespaces
in the cluster. This option is not always available.
A specific namespace on the cluster allows you to choose a specific, single namespace in which to install the Operator. The Operator will only watch and be made available for use in this single namespace.
Select an Update Channel (if more than one is available).
Select Automatic or Manual approval strategy, as described earlier.
Click Subscribe to make the Operator available to the selected namespaces on this OpenShift Container Platform cluster.
If you selected a Manual approval strategy, the Subscription’s upgrade status will remain Upgrading until you review and approve its Install Plan.
After approving on the Install Plan page, the Subscription upgrade status moves to Up to date.
If you selected an Automatic approval strategy, the upgrade status should resolve to Up to date without intervention.
After the Subscription’s upgrade status is Up to date, select Operators → Installed Operators to verify that the Couchbase ClusterServiceVersion (CSV) eventually shows up and its Status ultimately resolves to InstallSucceeded in the relevant namespace.
For the All namespaces… Installation Mode, the status resolves to
InstallSucceeded in the |
If it does not:
Check the logs in any Pods in the openshift-operators
project (or other
relevant namespace if A specific namespace… Installation Mode was selected)
on the Workloads → Pods page that are reporting issues to troubleshoot
further.
Instead of using the OpenShift Container Platform web console, you can install an Operator
from the OperatorHub using the CLI. Use the oc
command to create or update a
Subscription object.
Access to an OpenShift Container Platform cluster using an account with cluster-admin
permissions.
Install the oc command to your local system.
View the list of Operators available to the cluster from the OperatorHub.
$ oc get packagemanifests -n openshift-marketplace NAME CATALOG AGE 3scale-operator Red Hat Operators 91m amq-online Red Hat Operators 91m amq-streams Red Hat Operators 91m ... couchbase-enterprise-certified Certified Operators 91m mariadb Certified Operators 91m mongodb-enterprise Certified Operators 91m ... etcd Community Operators 91m jaeger Community Operators 91m kubefed Community Operators 91m ...
Note the CatalogSource(s) for your desired Operator(s).
Inspect your desired Operator to verify its supported InstallModes and available Channels:
$ oc describe packagemanifests <operator_name> -n openshift-marketplace
An OperatorGroup is an OLM resource that selects target namespaces in which to generate required RBAC access for all Operators in the same namespace as the OperatorGroup.
The namespace to which you subscribe the Operator must have an OperatorGroup
that matches the Operator’s InstallMode, either the AllNamespaces
or
SingleNamespace
mode. If the Operator you intend to install uses the
AllNamespaces
, then the openshift-operators
namespace already has an
appropriate OperatorGroup in place.
However, if the Operator uses the SingleNamespace
mode and you do not already
have an appropriate OperatorGroup in place, you must create one.
The web console version of this procedure handles the creation of the
OperatorGroup and Subscription objects automatically behind the scenes for you
when choosing |
Create an OperatorGroup object YAML file, for example operatorgroup.yaml
:
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: <operatorgroup_name>
namespace: <namespace>
spec:
targetNamespaces:
- <namespace>
Create the OperatorGroup object:
$ oc apply -f operatorgroup.yaml
Create a Subscription object YAML file to subscribe a namespace to an Operator,
for example sub.yaml
:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: <operator_name>
namespace: openshift-operators (1)
spec:
channel: alpha
name: <operator_name> (2)
source: redhat-operators (3)
sourceNamespace: openshift-marketplace (4)
1 | For AllNamespaces InstallMode usage, specify the openshift-operators
namespace. Otherwise, specify the relevant single namespace for
SingleNamespace InstallMode usage. |
2 | Name of the Operator to subscribe to. |
3 | Name of the CatalogSource that provides the Operator. |
4 | Namespace of the CatalogSource. Use openshift-marketplace for the default
OperatorHub CatalogSources. |
Create the Subscription object:
$ oc apply -f sub.yaml
At this point, the OLM is now aware of the selected Operator. A ClusterServiceVersion (CSV) for the Operator should appear in the target namespace, and APIs provided by the Operator should be available for creation.