|
| 1 | +--- |
| 2 | +title: ":ref:`Deploy a Multi-Cluster Replica Set <multi-cluster-quick-start-ref>`." |
| 3 | +stepnum: 1 |
| 4 | +level: 4 |
| 5 | +ref: pre-deploy-replicaset |
| 6 | +content: | |
| 7 | +
|
| 8 | +--- |
| 9 | +title: ":ref:`Secure the Multi-Cluster with TLS <multi-cluster-secure-tls>`." |
| 10 | +level: 4 |
| 11 | +stepnum: 2 |
| 12 | +ref: enable-tls--replicaset |
| 13 | +content: | |
| 14 | +
|
| 15 | + Provide values for: |
| 16 | +
|
| 17 | + - The |tls| secret in :setting:`spec.security.certsSecretPrefix`. |
| 18 | + - The custom |certauth| certificate in :setting:`spec.security.tls.ca`. |
| 19 | +
|
| 20 | +--- |
| 21 | +title: "Add Subject Alternate Names to your |tls| certificates." |
| 22 | +level: 4 |
| 23 | +stepnum: 3 |
| 24 | +ref: remove-tls-existing-replicasets |
| 25 | +content: | |
| 26 | +
|
| 27 | + Add each external |dns| name to the certificate |san-dns|. |
| 28 | +
|
| 29 | +--- |
| 30 | +title: "Create a ``NodePort`` service for each of the Pods in different clusters." |
| 31 | +level: 4 |
| 32 | +stepnum: 4 |
| 33 | +ref: k8s-ext-rs-create-nodeports |
| 34 | +content: | |
| 35 | +
|
| 36 | + When you create a ``NodePort`` service with ``kubectl``, it assigns a |
| 37 | + random port in the range from 30000 to 32767, inclusive. |
| 38 | +
|
| 39 | + 1. Create a NodePort service. |
| 40 | +
|
| 41 | + - To create a NodePort service that uses a randomly assigned port, run |
| 42 | + the following command on each Pod in each cluster: |
| 43 | +
|
| 44 | + .. code-block:: sh |
| 45 | +
|
| 46 | + kubectl expose pod/<my-replica-set>-0 --type="NodePort" --port 27017 |
| 47 | +
|
| 48 | + - To create a NodePort service that uses a deterministic port, on each |
| 49 | + Pod in each cluster, create a ``Nodeport`` service definition YAML |
| 50 | + file similar to the following example. Specify the port you want |
| 51 | + to use in the :setting:`spec.ports.NodePort` setting. This example |
| 52 | + configures a NodePort service on port 30007. |
| 53 | +
|
| 54 | + .. code-block:: yaml |
| 55 | +
|
| 56 | + apiVersion: v1 |
| 57 | + kind: Service |
| 58 | + metadata: |
| 59 | + name: <my-replica-set>-0 |
| 60 | + labels: |
| 61 | + controller: mongodb-enterprise-operator |
| 62 | + spec: |
| 63 | + type: NodePort |
| 64 | + selector: |
| 65 | + controller: mongodb-enterprise-operator |
| 66 | + ports: |
| 67 | + port: 27017 |
| 68 | + targetPort: 27017 |
| 69 | + nodePort: 30007 |
| 70 | +
|
| 71 | +
|
| 72 | + Apply the YAML with ``kubectl apply -f <nodeport-conf>.yaml``. |
| 73 | +
|
| 74 | +--- |
| 75 | +title: "Verify the NodePort services." |
| 76 | +level: 4 |
| 77 | +stepnum: 5 |
| 78 | +ref: k8s-ext-rs-discover-nodeports |
| 79 | +content: | |
| 80 | +
|
| 81 | + In each cluster, run this command to verify the NodePort services that |
| 82 | + you created: |
| 83 | +
|
| 84 | + .. code-block:: sh |
| 85 | +
|
| 86 | + $ kubectl get svc <node_port_service_name> |
| 87 | +
|
| 88 | + The command returns results similar to the following example: |
| 89 | +
|
| 90 | + .. code-block:: sh |
| 91 | +
|
| 92 | + NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 93 | + <node_port_service_name> NodePort 10.102.27.116 <none> 27017:30007/TCP 8m30s |
| 94 | +
|
| 95 | +--- |
| 96 | +title: "Update your replica set resource |yaml| file." |
| 97 | +level: 4 |
| 98 | +stepnum: 6 |
| 99 | +ref: update-replset-resource-mc-split-horizon |
| 100 | +content: | |
| 101 | +
|
| 102 | + Set the hostnames and ports in :setting:`spec.connectivity.replicaSetHorizons` |
| 103 | + to the NodePort values that you created in the previous step. |
| 104 | +
|
| 105 | + Confirm that you specified the correct external hostnames. External |
| 106 | + hostnames should match the |dns| names of |k8s| worker nodes. |
| 107 | + These can be *any* nodes in the |k8s| cluster. If the Pod runs on another |
| 108 | + node, |k8s| nodes use internal routing. |
| 109 | +
|
| 110 | + .. code-block:: sh |
| 111 | +
|
| 112 | + apiVersion: mongodb.com/v1 |
| 113 | + kind: MongoDBMulti |
| 114 | + metadata: |
| 115 | + name: multi-cluster-replica-set |
| 116 | + namespace: mongodb |
| 117 | + spec: |
| 118 | + clusterSpecList: |
| 119 | + clusterSpecs: |
| 120 | + - clusterName: e2e.cluster1.mongokubernetes.com |
| 121 | + members: 1 |
| 122 | + - clusterName: e2e.cluster2.mongokubernetes.com |
| 123 | + members: 1 |
| 124 | + - clusterName: e2e.cluster3.mongokubernetes.com |
| 125 | + members: 1 |
| 126 | + connectivity: |
| 127 | + replicaSetHorizons: |
| 128 | + - sample-horizon: web1.example.com:30907 |
| 129 | + - sample-horizon: web2.example.com:30907 |
| 130 | + - sample-horizon: web3.example.com:30907 |
| 131 | + credentials: my-credentials |
| 132 | + duplicateServiceObjects: false |
| 133 | + opsManager: |
| 134 | + configMapRef: |
| 135 | + name: my-project |
| 136 | + persistent: true |
| 137 | + security: |
| 138 | + certsSecretPrefix: clustercert |
| 139 | + tls: |
| 140 | + ca: issuer-ca |
| 141 | + type: ReplicaSet |
| 142 | + version: 4.4.0-ent" |
| 143 | +
|
| 144 | +--- |
| 145 | +title: "Apply the updated replica set file." |
| 146 | +level: 4 |
| 147 | +stepnum: 7 |
| 148 | +ref: apply-crd |
| 149 | +content: | |
| 150 | +
|
| 151 | + In each cluster, run this command to apply the updated replica set file: |
| 152 | +
|
| 153 | + .. code-block:: sh |
| 154 | +
|
| 155 | + $ Kubectl apply -f <file_name.yaml> |
| 156 | +
|
| 157 | +--- |
| 158 | +level: 4 |
| 159 | +stepnum: 8 |
| 160 | +ref: k8s-ext-rs-test-conn-horizon-mc |
| 161 | +inherit: |
| 162 | + file: steps-source-deploy-k8s-resource.yaml |
| 163 | + ref: k8s-ext-rs-test-conn |
| 164 | + |
| 165 | +... |
0 commit comments