Install WebSphere Liberty operator with the Kubernetes CLI
A cluster administrator can install a WebSphere Liberty operator with the Kubernetes command-line interface (CLI) (kubectl) when the cluster is not a Red Hat OpenShift Container Platform cluster. Example Kubernetes environments that do not use the OpenShift Container Platform include Azure Kubernetes Service (AKS) or Amazon Elastic Kubernetes Service (EKS).
WebSphere Liberty operator requires a Kubernetes cluster. Use kubectl to run commands against the Kubernetes cluster.
Install prerequisites.
If we plan to use Operator Lifecycle Manager (OLM), it must be installed on your cluster before you proceed. In addition, we need the IBM Operator catalog source. The CatalogSources pods must be running.
Log in to the Kubernetes cluster as a cluster administrator.
Follow the instructions for installing WebSphere Liberty operator on a non-OCP Kubernetes cluster with OLM or without OLM.
Install the WebSphere Liberty operator with OLM
The operator supports OwnNamespace, SingleNamespace, and AllNamespaces install modes. The AllNamespaces installation mode applies to most installations.
- Set the WLO_NAMESPACE and WLO_TARGET_NAMESPACE shell
variables.
For the AllNamespaces installation mode, set WLO_NAMESPACE to operators.
WLO_NAMESPACE=operators
For the SingleNamespace mode 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 the OwnNamespace mode, set the WLO_NAMESPACE environment variable and the WLO_TARGET_NAMESPACE environment variable to the same value.
WLO_NAMESPACE=my-wlo-namespace WLO_TARGET_NAMESPACE=my-wlo-namespace
- Create the namespaces, if needed.
For AllNamespaces installation mode, the operators namespace already exists.
kubectl create namespace $WLO_NAMESPACE kubectl create namespace $WLO_TARGET_NAMESPACE
Note: For security considerations applicable at the namespace level, see Set limits with the ResourceQuota resource.
- For either OwnNamespace or SingleNamespace mode, create an OperatorGroup.
Note: If we are using the default AllNamespaces mode, skip this step.
cat <<EOF | kubectl apply -f - apiVersion: operators.coreos.com/v1alpha2 kind: OperatorGroup metadata: name: ibm-websphere-liberty namespace: $WLO_NAMESPACE spec: targetNamespaces: - $WLO_TARGET_NAMESPACE EOF
- Install WebSphere Liberty operator.
cat <<EOF | kubectl 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: olm EOF
Install the WebSphere Liberty operator without OLM
The operator supports OwnNamespace, SingleNamespace, and AllNamespaces installation modes. The AllNamespaces installation mode applies to most installations.
In a non-OCP Kubernetes environment without OLM, an option is to use kustomize. For more information, see Install WebSphere Liberty operator with kustomize.
- Install Custom Resource Definition (CRD) resources for WebSphereLibertyApplication and Day-2 operations WebSphereLibertyTrace and WebSphereLibertyDump. This needs to be done only once per
cluster.
kubectl apply --server-side -f https://raw.githubusercontent.com/WASdev/websphere-liberty-operator/main/deploy/releases/1.4.4/kubectl/websphereliberty-app-crd.yaml
- Create environment variables and namespaces.
- Set the operator namespace and the target namespace to watch.
For the AllNamespaces installation mode, set WLO_TARGET_NAMESPACE to '""'.
WLO_NAMESPACE=my-wlo-namespace WLO_TARGET_NAMESPACE='""'
For the SingleNamespace mode 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 the OwnNamespace mode, set the WLO_NAMESPACE environment variable and the WLO_TARGET_NAMESPACE environment variable to the same value.
WLO_NAMESPACE=my-wlo-namespace WLO_TARGET_NAMESPACE=my-wlo-namespace
- Create any namespaces needed.
kubectl create namespace $WLO_NAMESPACE kubectl create namespace $WLO_TARGET_NAMESPACE
Note: For security considerations applicable at the namespace level, see Set limits with the ResourceQuota resource.
- Set the operator namespace and the target namespace to watch.
- Install roles and bindings to watch another namespace or all namespaces.
Skip this step if the operator is watching its own namespace.
- To watch all namespaces, install cluster-level role-based
access:
curl -L https://raw.githubusercontent.com/WASdev/websphere-liberty-operator/main/deploy/releases/1.4.4/kubectl/websphereliberty-app-rbac-watch-all.yaml \ | sed -e "s/WEBSPHERE_LIBERTY_OPERATOR_NAMESPACE/${WLO_NAMESPACE}/" \ | kubectl apply -f -
- To watch another namespace, install role with access to another
namespace:
curl -L https://raw.githubusercontent.com/WASdev/websphere-liberty-operator/main/deploy/releases/1.4.4/kubectl/websphereliberty-app-rbac-watch-another.yaml \ | sed -e "s/WEBSPHERE_LIBERTY_OPERATOR_NAMESPACE/${WLO_NAMESPACE}/" \ | sed -e "s/WEBSPHERE_LIBERTY_WATCH_NAMESPACE/${WLO_TARGET_NAMESPACE}/" \ | kubectl apply -f -
- To watch all namespaces, install cluster-level role-based
access:
- Install WebSphere Liberty operator.
curl -L https://raw.githubusercontent.com/WASdev/websphere-liberty-operator/main/deploy/releases/1.4.4/kubectl/websphereliberty-app-operator.yaml \ | sed -e "s/WEBSPHERE_LIBERTY_WATCH_NAMESPACE/${WLO_TARGET_NAMESPACE}/" \ | kubectl apply -n ${WLO_NAMESPACE} -f -
What to do next
At your discretion, we can deploy the sample application. If the operator failed to install correctly, view the logs.
kubectl logs -l control-plane=websphere-liberty-controller-manager