Skip to content

Commit f9f6ae7

Browse files
(DOCSP-13959): cross-namespace deployment docs (#319)
1 parent 8fbfee2 commit f9f6ae7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

docs/install-upgrade.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- [Install the Operator](#install-the-operator)
66
- [Prerequisites](#prerequisites)
7+
- [Understand Deployment Scopes](#understand-deployment-scopes)
78
- [Procedure](#procedure)
89
- [Upgrade the Operator](#upgrade-the-operator)
910

@@ -20,6 +21,57 @@ Before you install the MongoDB Community Kubernetes Operator, you must:
2021
```
2122
git clone https://github.com/mongodb/mongodb-kubernetes-operator.git
2223
```
24+
4. Review the possible Operator [deployment scopes](#understand-mongodb-community-operator-deployment-scopes) and configure the Operator to watch other namespaces, if necessary.
25+
26+
### Understand Deployment Scopes
27+
28+
You can deploy the MongoDB Community Kubernetes Operator with different scopes based on where you want to deploy MongoDB resources:
29+
30+
- [Operator in Same Namespace as Resources](#operator-in-same-namespace-as-resources)
31+
- [Operator in Different Namespace Than Resources](#operator-in-different-namespace-than-resources)
32+
33+
#### Operator in Same Namespace as Resources
34+
35+
You scope the Operator to a namespace. The Operator watches MongoDB resources in that same [namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/).
36+
37+
This is the default scope when you install the Operator using the [installation instructions](#procedure).
38+
39+
#### Operator in Different Namespace Than Resources
40+
41+
You scope the Operator to a namespace. The Operator watches MongoDB resources in other namespaces.
42+
43+
To configure the Operator to watch resources in other namespaces:
44+
45+
1. In the Operator [resource definition](../deploy/operator/operator.yaml), set the `WATCH_NAMESPACE` environment variable to one of the following values:
46+
47+
- the namespace that you want the Operator to watch, or
48+
- `*` to configure the Operator to watch all namespaces in the cluster.
49+
50+
```yaml
51+
spec:
52+
containers:
53+
- name: mongodb-kubernetes-operator
54+
image: quay.io/mongodb/mongodb-kubernetes-operator:0.5.0
55+
command:
56+
- mongodb-kubernetes-operator
57+
imagePullPolicy: Always
58+
env:
59+
- name: WATCH_NAMESPACE
60+
value: *
61+
```
62+
63+
2. Run the following command to create cluster-wide roles and role-bindings in the default namespace:
64+
65+
```sh
66+
kubectl apply -f deploy/clusterwide
67+
```
68+
3. For each namespace that you want the Operator to watch, run the following commands to deploy a role and role-binding in that namespace:
69+
70+
```sh
71+
kubectl apply -f deploy/operator/role.yaml -n <namespace> && kubectl apply -f deploy/operator/role_binding.yaml -n <namespace>
72+
```
73+
74+
4. [Install the operator](#procedure).
2375

2476
### Procedure
2577

0 commit comments

Comments
 (0)