Install WebSphere Liberty operator with kustomize

A cluster administrator can use kustomize to 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 and Operator Lifecycle Manager is not being used.


Install and watching own namespace

The base configuration installs the operator into the websphere-liberty namespace, and the operator watches for WebSphere Liberty custom resource instances only in its own namespace. Create a namespace called websphere-liberty for the operator. To install, run the following command.

    kubectl apply --server-side -k base

To uninstall, run the following command.

    kubectl delete -k base

The examples/watch-own-namespace overlay demonstrates how to modify the base configuration to install the operator and have it watch a namespace other than websphere-liberty. Create a namespace called wlo-ns for the operator. To install the operator into the wlo-ns namespace, run the following command.

    kubectl apply --server-side -k examples/watch-own-namespace


Install and watching another namespace

The overlays/watch-another-namespace overlay installs the operator into the namespace wlo-ns, but configures it to watch for WebSphere Liberty custom resource instances in a different namespace called wlo-watched-ns. Because this overlay installs resources into two different namespaces, the namespace must not be specified in the kustomize.yaml file. To install, run the following command.

    kubectl apply --server-side -k overlays/watch-another-namespace

The examples/watch-another-namespace example overlay builds on the previous one, but demonstrates how to change the install and watched namespaces. In this case, the operator is installed into wlo-ns2 and watches for resources in wlo-watched-ns2. To install, run the following command.

    kubectl apply --server-side -k examples/watch-another-namespace


Install and watching all namespaces

The overlays/watch-all-namespaces overlay installs the operator into the websphere-liberty namespace, but configures it to watch for WebSphere Liberty custom resource instances in any namespace. Compared to the base, this overlay requires additional ClusterRoles and ClusterRoleBindings. To install, run the following command.

    kubectl apply --server-side -k overlays/watch-all-namespaces

The examples/watch-all-namespaces example builds on the previous example and demonstrates how to change the namespace that the operator installs into. In this example, the operator installs into a namespace called wlo-ns and watches for WebSphere Liberty custom resource instances in any namespace. To install, run the following command.

    kubectl apply --server-side -k examples/watch-all-namespaces


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