Installing WebSphere Liberty operator with the Red Hat OpenShift CLI

A cluster administrator can install a WebSphere® Liberty operator and create an instance of WebSphere Liberty operator with the Red Hat OpenShift command-line interface (CLI).

Before you begin

Install prerequisites. See Preparing for installation.

WebSphere Liberty operator requires an Red Hat OpenShift cluster. You need the Red Hat OpenShift Container Platform (OCP) CLI to run Red Hat OpenShift CLI (oc) commands. Also, you need the IBM® Operator catalog source and the IBM Cloud Pak foundational services catalog source. The CatalogSources pods must be running.

Log in to the Red Hat OpenShift cluster as a cluster administrator.

Installing the WebSphere Liberty operator

The operator supports OwnNamespace, SingleNamespace, and AllNamespaces install modes. The AllNamespaces installation mode applies to most installations.

  1. Set the WLO_NAMESPACE and WLO_TARGET_NAMESPACE shell variables.

    For the AllNamespaces installation mode, set WLO_NAMESPACE to openshift-operators.

    WLO_NAMESPACE=openshift-operators

    For SingleNamespace where the operator watches a different namespace, set WLO_NAMESPACE to the name where the operator is installed, and set WLO_TARGET_NAMESPACE to the name of the namespace to be watched.

    WLO_NAMESPACE=my-wlo-namespace
    WLO_TARGET_NAMESPACE=websphere-liberty-target

    For OwnNamespace mode, set WLO_NAMESPACE and WLO_TARGET_NAMESPACE to the same value.

    WLO_NAMESPACE=my-wlo-namespace
    WLO_TARGET_NAMESPACE=my-wlo-namespace
  2. Create the namespaces, if needed.

    For AllNamespaces installation mode, the openshift-operators namespace already exists.

    oc create namespace $WLO_NAMESPACE
    Note: For security considerations applicable at the namespace level, see Setting limits with the ResourceQuota resource.
  3. For either an OwnNamespace or SingleNamespace installation mode, create an OperatorGroup.
    Note: For the default AllNamespaces mode, skip this step.
    cat <<EOF | oc apply -f -
    apiVersion: operators.coreos.com/v1alpha2
    kind: OperatorGroup
    metadata:
      name: ibm-websphere-liberty
      namespace: $WLO_NAMESPACE
    spec:
      targetNamespaces:
      - $WLO_TARGET_NAMESPACE
    EOF
  4. Create a Subscription to install WebSphere Liberty operator.
    cat <<EOF | oc apply -f -
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: ibm-websphere-liberty
      namespace: $WLO_NAMESPACE
    spec:
      installPlanApproval: Automatic
      name: ibm-websphere-liberty
      source: ibm-operator-catalog
      sourceNamespace: openshift-marketplace
    EOF

Results

The operator can take some time to install. You can check the status of the installation with the following command.
  • To ensure that the wlo-controller-manager pod is running:
    $ oc get pods -n $WLO_NAMESPACE
    NAME                                      READY   STATUS    RESTARTS   AGE
    wlo-controller-manager-78d89454c7-lhs72   1/1     Running   0          109s
  • To check the status of the WebSphere Liberty operator:
    $ oc get WebSphereLiberty -n $WLO_INSTANCE_NAMESPACE
    NAME         READY   AGE
    websphere-liberty   False   5m39s

What to do next

Validate the installation. At your discretion, you can deploy the sample application.