@@ -9,7 +9,7 @@ Multi-Cluster Prerequisites
9
9
.. contents:: On this page
10
10
:local:
11
11
:backlinks: none
12
- :depth: 2
12
+ :depth: 1
13
13
:class: singlecol
14
14
15
15
@@ -88,6 +88,7 @@ Set up |gke| clusters:
88
88
--num-nodes=5 \
89
89
--machine-type "e2-standard-2"
90
90
91
+ .. _multi-cluster-user-auth-clusters-ref:
91
92
92
93
Obtain User Authentication Credentials for Central and Member clusters
93
94
----------------------------------------------------------------------
@@ -130,6 +131,153 @@ Install the following tools:
130
131
131
132
3. `Install Helm <https://helm.sh/docs/intro/install/>`__.
132
133
134
+
135
+ .. _mc-namespace-scope-ref:
136
+
137
+ Set the Deployment's Scope
138
+ --------------------------
139
+
140
+ By default, the multi-cluster |k8s-op-short| is scoped to the |k8s-ns|
141
+ in which it is installed. The |k8s-op-short| reconciles the
142
+ ``MongoDBMulti`` custom resource deployed in the same namespace as the
143
+ |k8s-op-short|.
144
+
145
+ When you run the :github:`multi-cluster kubeconfig creator
146
+ </mongodb/mongodb-enterprise-kubernetes/blob/master/tools/multicluster/main.go>`
147
+ tool as part of the :ref:`multi-cluster Quick Start procedure
148
+ <multi-cluster-quick-start-procedure>`, and don't modify the tool's
149
+ settings, the tool:
150
+
151
+ - Creates a single ``mongodb`` namespace in the central cluster and
152
+ each member cluster.
153
+ - Creates Service Accounts, Roles, and RoleBindings in the central
154
+ cluster and each member cluster.
155
+ - Applies the correct permissions for service accounts.
156
+ - Uses these settings to create your |multi-cluster|.
157
+
158
+ Once the multi-cluster is deployed, the |k8s-op-short| starts watching
159
+ |k8s-mdbrscs| in the ``mongodb`` |k8s-ns|.
160
+
161
+ To configure the |k8s-op-short| with the correct permissions to deploy
162
+ in multiple or all namespaces, run the following command and specify the
163
+ namespaces that you would like the |k8s-op-short| to watch.
164
+
165
+ .. code-block:: sh
166
+
167
+ cd tools/multicluster
168
+ go run main.go \
169
+ -central-cluster="e2e.operator.mongokubernetes.com" \
170
+ -member-clusters="e2e.cluster1.mongokubernetes.com,e2e.cluster2.mongokubernetes.com,e2e.cluster3.mongokubernetes.com" \
171
+ -member-cluster-namespace="mongodb2" \
172
+ -central-cluster-namespace="mongodb2" \
173
+ -cluster-scoped="true"
174
+
175
+ When you install the |multi-cluster| to multiple or all |k8s-nss|, you
176
+ can configure the |k8s-op-short| to:
177
+
178
+ - :ref:`Watch Resources in Multiple Namespaces <mc-cluster-many-namespaces-ref>`
179
+ - :ref:`Watch Resources in All Namespaces <mc-cluster-all-namespaces-ref>`
180
+
181
+ .. _mc-cluster-many-namespaces-ref:
182
+
183
+ Watch Resources in Multiple Namespaces
184
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185
+
186
+ If you set the scope for the |multi-cluster| to many |k8s-nss|, you can
187
+ configure the |k8s-op-short| to watch |k8s-mdbrscs| in these namespaces
188
+ in the |multi-cluster|.
189
+
190
+ .. tabs::
191
+
192
+ .. tab:: Using kubectl
193
+ :tabid: mc-kubectl
194
+
195
+
196
+ 1. Use the :github:`mongodb-enterprise.yaml
197
+ </mongodb/mongodb-enterprise-kubernetes/blob/master/mongodb-enterprise.yaml>`
198
+ sample |yaml| file from the MongoDB Enterprise Kubernetes Operator GitHub
199
+ repository.
200
+ #. Set the ``spec.template.spec.containers.name.env.name:WATCH_NAMESPACE`` in
201
+ :github:`mongodb-enterprise.yaml
202
+ </mongodb/mongodb-enterprise-kubernetes/blob/master/mongodb-enterprise.yaml>`
203
+ to the comma-separated list of namespaces that you would like
204
+ the |k8s-op-short| to watch:
205
+
206
+ .. code-block:: sh
207
+
208
+ WATCH_NAMESPACE: "$namespace1,$namespace2,$namespace3"
209
+
210
+
211
+ .. tab:: Using Helm
212
+ :tabid: mc-with-helm
213
+
214
+ Run the following command and replace the values in the last line
215
+ with the namespaces that you would like the |k8s-op-short| to
216
+ watch.
217
+
218
+ .. code-block:: sh
219
+
220
+ helm upgrade \
221
+ --install \
222
+ mongodb-enterprise-operator-multi-cluster \
223
+ mongodb/enterprise-operator \
224
+ --namespace mongodb \
225
+ --set namespace=mongodb \
226
+ --version <mongodb-kubernetes-operator-version>\
227
+ --set operator.name=mongodb-enterprise-operator-multi-cluster \
228
+ --set operator.createOperatorServiceAccount=false \
229
+ --set "multiCluster.clusters=$MDB_CLUSTER_1_FULL_NAME,$MDB_CLUSTER_2_FULL_NAME,$MDB_CLUSTER_3_FULL_NAME"
230
+ --set operator.watchNamespace="$namespace1,$namespace2,$namespace3"
231
+
232
+ .. _mc-cluster-all-namespaces-ref:
233
+
234
+ Watch Resources in All Namespaces
235
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236
+
237
+ If you set the scope for the |multi-cluster| to all |k8s-nss| instead
238
+ of the default ``mongodb`` namespace, you can configure the |k8s-op-short|
239
+ to watch |k8s-mdbrscs| in all namespaces in the |multi-cluster|.
240
+
241
+ .. tabs::
242
+
243
+ .. tab:: Using kubectl
244
+ :tabid: mc-kubectl
245
+
246
+
247
+ 1. Use the :github:`mongodb-enterprise.yaml
248
+ </mongodb/mongodb-enterprise-kubernetes/blob/master/mongodb-enterprise.yaml>`
249
+ sample |yaml| file from the MongoDB Enterprise Kubernetes
250
+ Operator GitHub repository.
251
+ #. Set the ``spec.template.spec.containers.name.env.name:WATCH_NAMESPACE``
252
+ in :github:`mongodb-enterprise.yaml
253
+ </mongodb/mongodb-enterprise-kubernetes/blob/master/mongodb-enterprise.yaml>`
254
+ to ``*``:
255
+
256
+ .. code-block:: sh
257
+
258
+ WATCH_NAMESPACE: "*"
259
+
260
+ .. tab:: Using Helm
261
+ :tabid: mc-with-helm
262
+
263
+ Run the following command:
264
+
265
+ .. code-block:: sh
266
+
267
+ helm upgrade \
268
+ --install \
269
+ mongodb-enterprise-operator-multi-cluster \
270
+ mongodb/enterprise-operator \
271
+ --namespace mongodb \
272
+ --set namespace=mongodb \
273
+ --version <mongodb-kubernetes-operator-version>\
274
+ --set operator.name=mongodb-enterprise-operator-multi-cluster \
275
+ --set operator.createOperatorServiceAccount=false \
276
+ --set "multiCluster.clusters=$MDB_CLUSTER_1_FULL_NAME,$MDB_CLUSTER_2_FULL_NAME,$MDB_CLUSTER_3_FULL_NAME"
277
+ --set operator.watchNamespace="*"
278
+
279
+ .. _mc-cluster-check-connectivity-ref:
280
+
133
281
Check Connectivity Across Clusters
134
282
----------------------------------
135
283
0 commit comments