|
1 | 1 | ---
|
2 | 2 | stepnum: 1
|
3 | 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 |
| -
|
| 4 | +ref: clone-k8s-qs |
| 5 | +inherit: |
| 6 | + file: steps-multi-cluster-source.yaml |
| 7 | + ref: clone-k8s-repo-multi-cluster |
12 | 8 | ---
|
13 | 9 | stepnum: 2
|
14 | 10 | 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 |
| -
|
| 11 | +ref: run-mc-tool-qs |
| 12 | +inherit: |
| 13 | + file: steps-multi-cluster-source.yaml |
| 14 | + ref: run-multi-cluster-tool |
36 | 15 | ---
|
37 | 16 | stepnum: 3
|
38 | 17 | 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 |
| -
|
| 18 | +ref: set-istio-webhook-qs |
| 19 | +inherit: |
| 20 | + file: steps-multi-cluster-source.yaml |
| 21 | + ref: set-istio-webhook |
74 | 22 | ---
|
75 | 23 | stepnum: 4
|
76 | 24 | 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 |
| 25 | +ref: configure-kubectl-mc-qs |
| 26 | +inherit: |
| 27 | + file: steps-multi-cluster-source.yaml |
| 28 | + ref: configure-kubectl-mc |
91 | 29 |
|
92 | 30 | ---
|
93 | 31 | stepnum: 5
|
94 | 32 | 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|: |
| 33 | +ref: install-kubectl-mc-qs |
| 34 | +inherit: |
| 35 | + file: steps-multi-cluster-source.yaml |
| 36 | + ref: install-kubectl-mc |
101 | 37 |
|
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 | 38 | ---
|
114 | 39 | stepnum: 6
|
115 | 40 | 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`. |
| 41 | +ref: deploy-mdbresource-mc-qs |
| 42 | +inherit: |
| 43 | + file: steps-multi-cluster-source.yaml |
| 44 | + ref: deploy-mdbresource-mc |
122 | 45 |
|
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 | 46 | ---
|
202 | 47 | stepnum: 7
|
203 | 48 | 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 |
| 49 | +ref: verify-mdb-resources-mc-qs |
| 50 | +inherit: |
| 51 | + file: steps-multi-cluster-source.yaml |
| 52 | + ref: verify-mdb-resources-mc |
233 | 53 |
|
234 |
| - kubectl --context=$MDB_CENTRAL_CLUSTER_FULL_NAME \ |
235 |
| - --namespace mongodb \ |
236 |
| - get mdbm multi-replica-set -o yaml -w |
237 | 54 | ...
|
0 commit comments