Skip to content

Commit e92e12b

Browse files
JuliaMongoirajdeep
andauthored
(DOCSP-23073) Multi-cluster namespace scope of many or all namespaces (#992)
* (DOCSP-23073) Multi-cluster namespace scope of many or all namespaces * Fixing the build warnings * Edits, may be ready for a review * Fix build warning * Edits * Edits * Edits * Added copy review, ready for a review by Raj * Apply suggestions from code review Comments from Raj Co-authored-by: Rajdeep Das <[email protected]> * Cleanup * Ready for a final tech review by Raj * Introduced a typo now fixed Co-authored-by: Rajdeep Das <[email protected]>
1 parent d676b2f commit e92e12b

7 files changed

+185
-31
lines changed

source/includes/steps-multi-cluster-source.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ ref: run-multi-cluster-tool
2727
title: "Run the ``multi-cluster kubeconfig creator`` tool."
2828
content: |
2929
30-
By default, the |k8s-op-short| uses the ``mongodb`` namespace.
31-
To simplify your installation, the tool creates one central cluster,
32-
three member clusters, and a namespace labeled ``mongodb`` in each of
33-
the clusters.
34-
30+
By default, the |k8s-op-short| is scoped to the ``mongodb`` namespace.
31+
The following command creates one central cluster, three member clusters,
32+
and a |k8s-ns| labeled ``mongodb`` in each of the clusters.
33+
3534
a. Change to the directory to which you cloned the |k8s-op-short|
3635
repository, and then to the directory that has the ``multi-cluster kubeconfig creator``
3736
tool.
@@ -110,9 +109,10 @@ level: 4
110109
title: "Install the |k8s-op-full| in the central cluster."
111110
ref: install-kubectl-mc
112111
content: |
113-
114-
Use the Helm charts for the |k8s-op-short| and multi-cluster deployments
115-
to install |k8s-op-short| for managing your |multi-cluster|:
112+
113+
Use the :mdb-github:`MongoDB Helm Charts for Kubernetes </helm-charts>`
114+
for |multi-clusters| to install |k8s-op-short| for managing your
115+
|multi-cluster|:
116116
117117
.. code-block:: sh
118118

source/multi-cluster-quick-start-overview.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ deploy as part of this tutorial.
7878

7979
To learn more, see the :ref:`multi-cluster-diagram`.
8080

81+
.. _multi-cluster-services-tools-ref:
82+
8183
Services and Tools
8284
------------------
8385

source/multi-cluster-quick-start-prerequisites.txt

Lines changed: 149 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Multi-Cluster Prerequisites
99
.. contents:: On this page
1010
:local:
1111
:backlinks: none
12-
:depth: 2
12+
:depth: 1
1313
:class: singlecol
1414

1515

@@ -88,6 +88,7 @@ Set up |gke| clusters:
8888
--num-nodes=5 \
8989
--machine-type "e2-standard-2"
9090

91+
.. _multi-cluster-user-auth-clusters-ref:
9192

9293
Obtain User Authentication Credentials for Central and Member clusters
9394
----------------------------------------------------------------------
@@ -130,6 +131,153 @@ Install the following tools:
130131

131132
3. `Install Helm <https://helm.sh/docs/intro/install/>`__.
132133

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+
133281
Check Connectivity Across Clusters
134282
----------------------------------
135283

source/multi-cluster-quick-start-procedure.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ Quick Start Procedure
1212
:depth: 2
1313
:class: singlecol
1414

15-
Before you begin, learn about |multi-clusters| implementation and complete
16-
the prerequisite steps:
15+
Before you begin, learn about |multi-clusters| implementation,
16+
`multi-cluster services and tools <multi-cluster-services-tools-ref>`,
17+
and complete the prerequisite steps:
1718

1819
- :ref:`Overview <multi-cluster-quick-start-overview>`
1920
- :ref:`Prerequisites <multi-cluster-quick-start-prereqs>`
2021

22+
.. note::
23+
24+
The following procedure scopes your |multi-cluster| to a single
25+
|k8s-ns| named ``mongodb``. You can :ref:`set scope for your
26+
deployment <mc-namespace-scope-ref>` and use another |k8s-ns|,
27+
multiple, or all namespaces.
28+
2129
.. include:: /includes/steps/multi-cluster-beta-quick-start.rst
2230

source/multi-cluster-quick-start.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ Multi-Cluster Quick Start
1414

1515

1616
:ref:`multi-cluster-quick-start-prereqs`
17-
Set the environment variables and the
18-
`available GKE zones <https://cloud.google.com/compute/docs/regions-zones#available>`__
19-
where you deploy the clusters, set up |gke| clusters, save user
20-
authentication credentials for the central and member clusters,
21-
install tools, including a service mesh, Helm, and Go, and establish
22-
cluster connectivity.
17+
Set up |gke| clusters, install tools, set the deployment's scope, and
18+
check connectivity across member clusters.
2319

2420
:ref:`multi-cluster-quick-start-procedure`
25-
Follow the steps in this section to deploy |multi-clusters|.
21+
Deploy |multi-clusters|.
2622

2723

2824
.. class:: hidden

source/multi-cluster.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ Deploy Multiple Clusters (Beta)
1515
:class: singlecol
1616

1717
:ref:`multi-cluster-quick-start-overview`
18-
Learn about |multi-clusters|, terminology, and services and tools used to deploy |multi-clusters| in this Quick Start.
18+
Learn about |multi-clusters|, terminology, and services and tools used
19+
to deploy |multi-clusters| in this Quick Start.
1920

2021
:ref:`multi-cluster-arch-ref`
2122
Review the architecture diagram and limitations of the beta release.
2223

23-
2424
:ref:`multi-cluster-quick-start-ref`
2525
Deploy MongoDB replica sets on multiple |k8s| clusters that span
2626
different regions and availability zones.
@@ -44,10 +44,10 @@ Deploy Multiple Clusters (Beta)
4444
.. toctree::
4545
:titlesonly:
4646

47-
/multi-cluster-quick-start-overview
48-
/multi-cluster-arch
49-
/multi-cluster-quick-start
50-
/multi-cluster-secure
51-
/multi-cluster-connect
52-
/multi-cluster-troubleshooting
47+
Overview </multi-cluster-quick-start-overview>
48+
Architecture and Limitations </multi-cluster-arch>
49+
Quick Start </multi-cluster-quick-start>
50+
Secure </multi-cluster-secure>
51+
Access Resources </multi-cluster-connect>
52+
Troubleshoot </multi-cluster-troubleshooting>
5353

source/tutorial/set-scope-k8s-operator.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ deployed:
8484
will bind the ``clusterRole`` you created with the ServiceAccount
8585
the |k8s-op-short| is using on the namespace where you install it.
8686

87-
2. Include the ``clusterRole`` and ``clusterRoleBinding``
87+
2. Include the |k8s-cr| and |k8s-crb|
8888
in the default configuration files that you apply during the
8989
installation.
9090

91-
The following example illustrates how ``clusterRoles`` and
92-
``clusterRoleBindings`` work together in the cluster.
91+
The following example illustrates how the |k8s-cr| and |k8s-crb| work
92+
together in the cluster.
9393

9494
Suppose you create a ServiceAccount in the ``mongodb`` namespace, and
9595
then install the |k8s-op-short| in this namespace. The |k8s-op-short|
@@ -100,8 +100,8 @@ To set the |k8s-op-short| scope to watch namespaces ``ns1`` and ``ns2``:
100100
1. Obtain :k8sdocs:`cluster-admin privileges </reference/access-authn-authz/rbac/#user-facing-roles>`.
101101
2. Using these privileges, create a cluster-wide, non-namespaced |k8s-cr|.
102102
3. Create a |k8s-crb| in three namespaces: ``mongodb``, ``ns1``
103-
and ``ns2``. This ``clusterRoleBinding`` will bind the
104-
``clusterRole`` to the ServiceAccount in the ``mongodb`` namespace.
103+
and ``ns2``. This |k8s-crb| will bind the
104+
|k8s-cr| to the ServiceAccount in the ``mongodb`` namespace.
105105
The ``clusterRoleBinding`` will allow the |k8s-op-short| deployed in
106106
the ``mongodb`` namespace to access the resources described in the
107107
``clusterRole`` of the target namespace, that is, in ``mongodb``,

0 commit comments

Comments
 (0)