Skip to content

Commit 8db4961

Browse files
JuliaMongojwilliams-mongo
authored andcommitted
(DOCSP-18180) multi-cluster beta (#757)
* (DOCSP-18180) multi-cluster beta * Initial review, content restructuring * Build warnings removal * Edits, ready for a copy review * Adjust the table of contents * A few more edits * Address copy review round1 from John W * Address 2nd round of copy review * Remove exta bullet where it is not needed * A few more cleanup type edits * A few more nits * Address tech review from Ciprian * Fixed code block indentation in step 2 * Add minor edits to code examples for clarity * Add minor edits to code examples for clarity * Add minor edits to code examples for clarity * Add minor edits to code examples for clarity * Add minor edits to code examples for clarity
1 parent 3250f32 commit 8db4961

File tree

8 files changed

+564
-2
lines changed

8 files changed

+564
-2
lines changed

conf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
'.. |epoch-time| replace:: timestamp in the number of seconds that have elapsed since the `UNIX epoch <https://en.wikipedia.org/wiki/Unix_time?oldid=828172017>`__',
116116
'.. |fqdn| replace:: :abbr:`FQDN (fully qualified domain name)`',
117117
'.. |gcp| replace:: :abbr:`GCP (Google Cloud Platform)`',
118-
'.. |gke| replace:: :abbr:`GKE (Google Kubernetes Engine)`',
118+
'.. |gke| replace:: `GKE (Google Kubernetes Engine) <https://cloud.google.com/kubernetes-engine>`__',
119119
'.. |global-write-clusters| replace:: Global Clusters',
120120
'.. |global-write-cluster| replace:: Global Cluster',
121121
'.. |global-write| replace:: Global Writes',
@@ -130,7 +130,8 @@
130130
'.. |iso8601-duration| replace:: Duration in `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601?oldid=851138376#Durations>`__ notation',
131131
'.. |iso8601-time| replace:: Timestamp in `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601?oldid=793821205>`__ date and time format in |utc|',
132132
'.. |iso8601| replace:: `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601?oldid=793821205>`__',
133-
'.. |jira| replace:: `Jira <https://jira.mongodb.org>`__"',
133+
'.. |istio| replace:: `Istio <https://istio.io/>`__',
134+
'.. |jira| replace:: `Jira <https://jira.mongodb.org>`__',
134135
'.. |json| replace:: :abbr:`JSON (Javascript Object Notation)`',
135136
'.. |jedec| replace:: :abbr:`JEDEC (Joint Electron Device Engineering Council Solid State Technology Association)`',
136137
'.. |jvm| replace:: :abbr:`JVM (Java Virtual Machine)`',
@@ -184,6 +185,8 @@
184185
'.. |mongod| replace:: :binary:`~bin.mongod`',
185186
'.. |mongos| replace:: :binary:`~bin.mongos`',
186187
'.. |mongo| replace:: :binary:`~bin.mongo`',
188+
'.. |multi-cluster| replace:: Multi-Cluster Deployment',
189+
'.. |multi-clusters| replace:: Multi-Cluster Deployments',
187190
'.. |oc| replace:: :xml:`<mono><link target="https://docs.openshift.com/container-platform/3.11/cli_reference/index.html">oc</link></mono>`',
188191
'.. |onprem| replace:: Ops Manager',
189192
'.. |onprem-link| replace:: :opsmgr:`Ops Manager </>`',

config/redirects

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ symlink: stable -> v1.12
1212
# Base URL
1313
raw: kubernetes-operator/ -> ${base}/stable/
1414

15+
# Add redirects related to the addition of new topics for multi-cluster
16+
# beta in the Operator v1.13.
17+
18+
[*-v1.12]: kubernetes-operator/${version}/multi-cluster -> ${base}/stable/multi-cluster
19+
[*-v1.12]: kubernetes-operator/${version}/multi-cluster-quick-start -> ${base}/stable/multi-cluster
20+
[*-v1.12]: kubernetes-operator/${version}/multi-cluster-arch -> ${base}/stable/multi-cluster
21+
1522
# Add redirects related to the removal of
1623
# /tutorial/migrate-to-single-resource. This topic was added initially
1724
# for v1.3 that is now EOL.

source/images/multi-cluster-arch.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
---
2+
stepnum: 1
3+
level: 4
4+
ref: clone-k8s-repo-multi-cluster
5+
title: "Clone the :github:`MongoDB Enterprise Kubernetes Operator repository </mongodb/mongodb-enterprise-kubernetes>`."
6+
content: |
7+
8+
.. code-block:: sh
9+
10+
git clone https://github.com/mongodb/mongodb-enterprise-kubernetes.git
11+
12+
---
13+
stepnum: 2
14+
level: 4
15+
ref: run-multi-cluster-tool
16+
title: "Run the ``multi-cluster kubeconfig creator`` tool."
17+
content: |
18+
19+
By default, the |k8s-op-short| uses the ``mongodb`` namespace.
20+
To simplify your installation, the tool creates one central cluster,
21+
three member clusters, and a namespace labeled ``mongodb`` in each of
22+
the clusters.
23+
24+
a. Change to the directory in which you cloned the repository.
25+
#. Run the :github:`multi-cluster kubeconfig creator </mongodb/mongodb-enterprise-kubernetes/blob/master/tools/multicluster/main.go>`
26+
tool:
27+
28+
.. code-block:: sh
29+
30+
go run tools/multicluster/main.go \
31+
-central-cluster="${MDB_CENTRAL_CLUSTER_FULL_NAME}" \
32+
-member-clusters="${MDB_CLUSTER_1_FULL_NAME},${MDB_CLUSTER_2_FULL_NAME},${MDB_CLUSTER_3_FULL_NAME}" \
33+
-member-cluster-namespace="mongodb" \
34+
-central-cluster-namespace="mongodb"
35+
36+
---
37+
stepnum: 3
38+
level: 4
39+
ref: set-istio-webhook
40+
title: "Set the Istio injection webhook in each member cluster."
41+
content: |
42+
43+
In each member cluster, label namespaces with the
44+
``istio-injection=enabled`` label to enable Istio's injection
45+
webhook. This ensures that any Pods that you create in these
46+
namespaces will have a sidecar added to them. To learn more, see
47+
`Automatic sidecar injection <https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection>`__
48+
in the Istio documentation.
49+
50+
.. code-block:: sh
51+
:emphasize-lines: 4
52+
53+
kubectl label \
54+
--context=$MDB_CLUSTER_1_FULL_NAME \
55+
--namespace mongodb \
56+
istio-injection=enabled
57+
58+
.. code-block:: sh
59+
:emphasize-lines: 4
60+
61+
kubectl label \
62+
--context=$MDB_CLUSTER_2_FULL_NAME \
63+
--namespace mongodb \
64+
istio-injection=enabled
65+
66+
.. code-block:: sh
67+
:emphasize-lines: 4
68+
69+
kubectl label \
70+
--context=$MDB_CLUSTER_3_FULL_NAME \
71+
--namespace mongodb \
72+
istio-injection=enabled
73+
74+
---
75+
stepnum: 4
76+
level: 4
77+
title: "Configure ``kubectl`` to use the central cluster's namespace."
78+
ref: configure-kubectl-mc
79+
content: |
80+
81+
If you have not done so already, run the following commands to execute
82+
all ``kubectl`` commands on the central cluster in the default
83+
namespace. In the following steps, you will install the |k8s-op-short|
84+
into this namespace.
85+
86+
.. code-block:: sh
87+
88+
kubectl config use-context $MDB_CENTRAL_CLUSTER_FULL_NAME
89+
kubectl config set-context $(kubectl config current-context) \
90+
--namespace=mongodb
91+
92+
---
93+
stepnum: 5
94+
level: 4
95+
title: "Install the |k8s-op-full| in the central cluster."
96+
ref: install-kubectl-mc
97+
content: |
98+
99+
Use Helm to install the |k8s-op-short| for managing your
100+
|multi-cluster|:
101+
102+
.. code-block:: sh
103+
104+
helm upgrade \
105+
--install \
106+
mongodb-enterprise-operator-multi-cluster \
107+
public/helm_chart \
108+
--namespace mongodb \
109+
--set namespace=mongodb \
110+
--set operator.name=mongodb-enterprise-operator-multi-cluster \
111+
--set operator.createOperatorServiceAccount=false \
112+
--set "multiCluster.clusters={${MDB_CLUSTER_1_FULL_NAME},${MDB_CLUSTER_2_FULL_NAME},${MDB_CLUSTER_3_FULL_NAME}}"
113+
---
114+
stepnum: 6
115+
title: "Deploy the MongoDB resource."
116+
ref: deploy-mdbresource-mc
117+
content: |
118+
119+
a. Create a secret in each member cluster so that the |k8s-op-short|
120+
can create and update objects in your |mms| project.
121+
To learn more, see :ref:`create-k8s-credentials`.
122+
123+
#. Create a ConfigMap in each member cluster to link the
124+
|k8s-op-short| to your |mms| project.
125+
To learn more, see :ref:`create-k8s-project`.
126+
127+
#. Configure the required service accounts in each member cluster:
128+
129+
.. code-block:: sh
130+
131+
helm template --show-only \
132+
templates/database-roles.yaml \
133+
public/helm_chart \
134+
--set namespace=mongodb | \
135+
kubectl apply -f - \
136+
--context=$MDB_CLUSTER_1_FULL_NAME \
137+
--namespace mongodb
138+
139+
.. code-block:: sh
140+
141+
helm template --show-only \
142+
templates/database-roles.yaml \
143+
public/helm_chart \
144+
--set namespace=mongodb | \
145+
kubectl apply -f - \
146+
--context=$MDB_CLUSTER_2_FULL_NAME \
147+
--namespace mongodb
148+
149+
.. code-block:: sh
150+
151+
helm template --show-only \
152+
templates/database-roles.yaml \
153+
public/helm_chart \
154+
--set namespace=mongodb | \
155+
kubectl apply -f - \
156+
--context=$MDB_CLUSTER_3_FULL_NAME \
157+
--namespace mongodb
158+
159+
#. Set :setting:`spec.credentials` and :setting:`spec.opsManager.configMapRef.name`
160+
and deploy the MongoDB resource.
161+
In the following code sample, ``duplicateServiceObjects``
162+
is set to ``true`` to enable
163+
`DNS proxying <https://istio.io/latest/docs/ops/configuration/traffic-management/dns-proxy/>`__
164+
in Istio.
165+
166+
.. note::
167+
To enable the cross-cluster DNS resolution by the Istio
168+
service mesh, this tutorial creates service objects with a
169+
single ClusterIP address per each |k8s| Pod.
170+
171+
.. code-block:: sh
172+
:emphasize-lines: 10,11,16-18
173+
174+
kubectl apply -f - <<EOF
175+
apiVersion: mongodb.com/v1
176+
kind: MongoDBMulti
177+
metadata:
178+
name: multi-replica-set
179+
spec:
180+
version: 4.4.0-ent
181+
type: ReplicaSet
182+
persistent: false
183+
duplicateServiceObjects: true
184+
credentials: my-credentials
185+
security:
186+
authentication:
187+
enabled: true
188+
modes: ["SCRAM"]
189+
opsManager:
190+
configMapRef:
191+
name: my-project
192+
clusterSpecList:
193+
clusterSpecs:
194+
- clusterName: ${MDB_CLUSTER_1_FULL_NAME}
195+
members: 3
196+
- clusterName: ${MDB_CLUSTER_2_FULL_NAME}
197+
members: 2
198+
- clusterName: ${MDB_CLUSTER_3_FULL_NAME}
199+
members: 3
200+
EOF
201+
---
202+
stepnum: 7
203+
level: 4
204+
title: "Verify that the MDB resources are running."
205+
ref: verify-mdb-resources-mc
206+
content: |
207+
208+
a. For member clusters, run the following commands to verify that
209+
the MongoDB Pods are in the running state:
210+
211+
.. code-block:: sh
212+
213+
kubectl get pods \
214+
--context=$MDB_CLUSTER_1_FULL_NAME \
215+
--namespace mongodb
216+
217+
.. code-block:: sh
218+
219+
kubectl get pods \
220+
--context=$MDB_CLUSTER_2_FULL_NAME \
221+
--namespace mongodb
222+
223+
.. code-block:: sh
224+
225+
kubectl get pods \
226+
--context=$MDB_CLUSTER_3_FULL_NAME \
227+
--namespace mongodb
228+
229+
#. In the central cluster, run the following commands to verify that
230+
the MongoDBMulti ``CustomResource`` is in the running state:
231+
232+
.. code-block:: sh
233+
234+
kubectl --context=$MDB_CENTRAL_CLUSTER_FULL_NAME \
235+
--namespace mongodb \
236+
get mdbm multi-replica-set -o yaml -w
237+
...

source/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ optimal performance.
5454
Install the Operator </installation>
5555
Deploy Ops Manager Resources </om-resources>
5656
Deploy MongoDB Database Resources </mdb-resources>
57+
Deploy Multiple Clusters (Beta) </multi-cluster>
5758
/tutorial/modify-resource-image
5859
/reference
5960
Release Notes </release-notes>

source/multi-cluster-arch.txt

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
.. _multi-cluster-arch:
2+
3+
===========================
4+
Multi-Cluster Architecture
5+
===========================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
.. _multi-cluster-beta-limitations:
16+
17+
Features Not Available in the Beta Release
18+
------------------------------------------
19+
20+
.. important::
21+
Use the beta release of the |multi-clusters| only in development
22+
environments.
23+
24+
The following features of the |k8s-op-full| and the underlying |k8s|
25+
clusters are not available in the beta release of the |multi-clusters|:
26+
27+
- Sharded cluster deployments
28+
- LDAP authentication
29+
- Backup and restore
30+
- X.509 user authentication
31+
- |onprem| version earlier than 5.0
32+
- Split Horizon
33+
- SRV record connection string
34+
35+
.. _multi-cluster-diagram:
36+
37+
Multi-Cluster Deployment Architecture
38+
-------------------------------------
39+
40+
The |k8s-op-full| runs in a central |k8s| cluster. If you deploy
41+
|onprem| with the |k8s-op-short|, the central cluster may also host
42+
|onprem|.
43+
The central cluster holds the ``MongoDBMulti`` CustomResource spec for
44+
the MongoDB replica set.
45+
The member |k8s| clusters host the MongoDB replica sets.
46+
47+
|istio| manages the discovery of MongoDB nodes deployed in different
48+
|k8s| member clusters.
49+
50+
You can host your application on any of the member clusters inside the
51+
Istio service mesh, either on |k8s| clusters outside of the ones that you
52+
deploy with the |k8s-op-short|, or on the member clusters that you deploy
53+
as part of this tutorial.
54+
55+
The |k8s-op-full| performs these actions:
56+
57+
- Identifies the cluster on which to deploy the MongoDB replica set
58+
using the corresponding ``MongoDBMulti`` CustomResource spec, and
59+
deploys the MongoDB replica sets.
60+
61+
- Watches for the ``MongoDBMulti`` CustomResource spec creation in the
62+
central cluster.
63+
64+
- Uses the mounted ``kubeconfig`` file to communicate with member clusters.
65+
66+
- Watches for the ``CentralCluster`` and ``MemberCluster`` events to
67+
confirm that the |multi-cluster| is in the desired state.
68+
69+
- Reconciles resources. Creates the necessary resources, such as
70+
Configmaps, Secrets, Service objects, and Statefulset objects in
71+
each member cluster corresponding to the number of replica set members
72+
in the MongoDB cluster.
73+
74+
.. figure:: /images/multi-cluster-arch.svg
75+
:alt: Diagram showing the high-level architecture of the multi-cluster
76+
deployment across regions and availability zones using the
77+
MongoDB Enterprise Kubernetes Operator
78+
:figwidth: 600px

0 commit comments

Comments
 (0)