:_mod-docs-content-type: PROCEDURE

// Module included in the following assemblies:
//
// deploying/assembly_deploy-cluster-operator.adoc

[id='deploying-cluster-operator-to-watch-multiple-namespaces-{context}']
= Deploying the Cluster Operator to watch multiple namespaces

[role="_abstract"]
This procedure shows how to deploy the Cluster Operator to watch Strimzi resources across multiple namespaces in your Kubernetes cluster.

.Prerequisites

* You need an account with permission to create and manage `CustomResourceDefinition` and RBAC (`ClusterRole`, and `RoleBinding`) resources.

.Procedure

. Edit the Strimzi installation files to use the namespace the Cluster Operator is going to be installed into.
+
For example, in this procedure the Cluster Operator is installed into the namespace `my-cluster-operator-namespace`.
+
include::../../shared/snip-cluster-operator-namespace-sed.adoc[]

. Edit the `install/cluster-operator/060-Deployment-strimzi-cluster-operator.yaml` file
to add a list of all the namespaces the Cluster Operator will watch to the `STRIMZI_NAMESPACE` environment variable.
+
For example, in this  procedure the Cluster Operator will watch the namespaces `watched-namespace-1`, `watched-namespace-2`, `watched-namespace-3`.
+
[source,yaml,subs="attributes"]
----
apiVersion: apps/v1
kind: Deployment
spec:
  # ...
  template:
    spec:
      serviceAccountName: strimzi-cluster-operator
      containers:
      - name: strimzi-cluster-operator
        image: {DockerClusterOperator}
        imagePullPolicy: IfNotPresent
        env:
        - name: STRIMZI_NAMESPACE
          value: watched-namespace-1,watched-namespace-2,watched-namespace-3
----

. For each namespace listed, install the `RoleBindings`.
+
In this example, we replace `watched-namespace` in these commands with the namespaces listed in the previous step,
repeating them for `watched-namespace-1`, `watched-namespace-2`, `watched-namespace-3`:
+
[source,shell]
kubectl create -f install/cluster-operator/020-RoleBinding-strimzi-cluster-operator.yaml -n <watched_namespace>
kubectl create -f install/cluster-operator/023-RoleBinding-strimzi-cluster-operator.yaml -n <watched_namespace>
kubectl create -f install/cluster-operator/031-RoleBinding-strimzi-cluster-operator-entity-operator-delegation.yaml -n <watched_namespace>

. Deploy the Cluster Operator:
+
[source,shell,subs="+quotes,attributes+"]
kubectl create -f install/cluster-operator -n my-cluster-operator-namespace

. Check the status of the deployment:
+
[source,shell,subs="+quotes"]
----
kubectl get deployments -n my-cluster-operator-namespace
----
+
.Output shows the deployment name and readiness
[source,shell,subs="+quotes"]
----
NAME                      READY  UP-TO-DATE  AVAILABLE
strimzi-cluster-operator  1/1    1           1
----
+
`READY` shows the number of replicas that are ready/expected.
The deployment is successful when the `AVAILABLE` output shows `1`.
