|
| 1 | +--- |
| 2 | +stepnum: 1 |
| 3 | +level: 4 |
| 4 | +ref: clone-k8s-repo-kind |
| 5 | +title: "Clone the :gh:`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: create-k8s-ns-kind |
| 16 | +title: "Create a |k8s-ns| for your |k8s| deployment." |
| 17 | +content: | |
| 18 | +
|
| 19 | + By default, The |k8s-op-short| uses the ``mongodb`` namespace. To |
| 20 | + simplify your installation, consider creating a namespace labeled |
| 21 | + ``mongodb`` using the following |kubectl| command: |
| 22 | +
|
| 23 | + .. code-block:: sh |
| 24 | +
|
| 25 | + kubectl create namespace mongodb |
| 26 | +
|
| 27 | +--- |
| 28 | +stepnum: 3 |
| 29 | +level: 4 |
| 30 | +ref: configure-kubectl-configmap-kind |
| 31 | +title: "Configure ``kubectl`` to default to your namespace." |
| 32 | +content: | |
| 33 | +
|
| 34 | + If you have not already, run the following command to execute all |
| 35 | + ``kubectl`` commands in the namespace you created: |
| 36 | +
|
| 37 | + .. code-block:: sh |
| 38 | +
|
| 39 | + kubectl config set-context $(kubectl config current-context) --namespace=mongodb |
| 40 | +
|
| 41 | +--- |
| 42 | +stepnum: 4 |
| 43 | +level: 4 |
| 44 | +title: "Install the |k8s-op-full|" |
| 45 | +ref: install-kubectl-kind |
| 46 | +content: | |
| 47 | +
|
| 48 | + 1. Change to the directory in which you cloned the repository. |
| 49 | +
|
| 50 | + #. Install the |k8s-crds| for MongoDB deployments using the |
| 51 | + following |kubectl| command: |
| 52 | +
|
| 53 | + .. code-block:: sh |
| 54 | +
|
| 55 | + kubectl apply -f crds.yaml |
| 56 | + |
| 57 | + #. Install the |k8s-op-short| using the following |kubectl| command: |
| 58 | + |
| 59 | + .. code-block:: sh |
| 60 | +
|
| 61 | + kubectl apply -f mongodb-enterprise.yaml |
| 62 | +
|
| 63 | +--- |
| 64 | +stepnum: 5 |
| 65 | +title: "Create credentials and store them as a secret." |
| 66 | +ref: create-k8s-credentials-kind |
| 67 | +content: | |
| 68 | +
|
| 69 | + Run the following command: |
| 70 | +
|
| 71 | + .. note:: |
| 72 | +
|
| 73 | + Provide your Public and Private Key values for the following |
| 74 | + parameters. To learn more, see :ref:`create-k8s-credentials`. |
| 75 | +
|
| 76 | + .. code-block:: sh |
| 77 | +
|
| 78 | + kubectl -n mongodb \ |
| 79 | + create secret generic ops-manager-admin-key \ |
| 80 | + --from-literal="user=<publicKey>" \ |
| 81 | + --from-literal="publicApiKey=<privateKey>" |
| 82 | + |
| 83 | +--- |
| 84 | +stepnum: 6 |
| 85 | +level: 4 |
| 86 | +title: "Invoke the following command to create a ConfigMap." |
| 87 | +ref: copy-k8s-configmap-kind |
| 88 | +content: | |
| 89 | +
|
| 90 | + .. note:: |
| 91 | +
|
| 92 | + Provide your values for the following parameters. To learn more, |
| 93 | + see the :doc:`parameter descriptions |
| 94 | + </tutorial/create-project-using-configmap>`. |
| 95 | +
|
| 96 | + .. code-block:: sh |
| 97 | +
|
| 98 | + kubectl create configmap myconfigmap \ |
| 99 | + --from-literal="baseUrl=<myOpsManagerURL>" \ |
| 100 | + --from-literal="projectName=<myOpsManagerProjectName>" \ #Optional |
| 101 | + --from-literal="orgId=<orgID>" #Required for Global API Keys |
| 102 | +
|
| 103 | +--- |
| 104 | +stepnum: 7 |
| 105 | +level: 4 |
| 106 | +title: "Deploy the :term:`replica set` resource." |
| 107 | +ref: deploy-replica-set-kind |
| 108 | +content: | |
| 109 | +
|
| 110 | + Run the following command: |
| 111 | +
|
| 112 | + .. code-block:: sh |
| 113 | +
|
| 114 | + cat <<EOF | kubectl apply -f - |
| 115 | + apiVersion: mongodb.com/v1 |
| 116 | + kind: MongoDB |
| 117 | + metadata: |
| 118 | + name: demo-mongodb-cluster-1 |
| 119 | + namespace: mongodb |
| 120 | + spec: |
| 121 | + members: 3 |
| 122 | + version: 4.4.5-ent |
| 123 | + type: ReplicaSet |
| 124 | + authentication: |
| 125 | + enabled: true |
| 126 | + modes: ["SHA"] |
| 127 | + opsManager: |
| 128 | + configMapRef: |
| 129 | + name: myconfigmap |
| 130 | + credentials: ops-manager-admin-key |
| 131 | + persistent: true |
| 132 | + podSpec: |
| 133 | + podTemplate: |
| 134 | + spec: |
| 135 | + containers: |
| 136 | + - name: mongodb-enterprise-database |
| 137 | + resources: |
| 138 | + limits: |
| 139 | + cpu: 2 |
| 140 | + memory: 1.5G |
| 141 | + requests: |
| 142 | + cpu: 1 |
| 143 | + memory: 1G |
| 144 | + persistence: |
| 145 | + single: |
| 146 | + storage: 10Gi |
| 147 | + EOF |
| 148 | +
|
| 149 | +--- |
| 150 | +stepnum: 8 |
| 151 | +level: 4 |
| 152 | +title: "Create a secret with your database user password" |
| 153 | +ref: create-k8s-user-secret-kind |
| 154 | +content: | |
| 155 | +
|
| 156 | + You can choose to use a cleartext password or a Base64-encoded |
| 157 | + password. Plaintext passwords use ``stringData.password`` and |
| 158 | + Base64-encoded passwords use ``data.password``. |
| 159 | +
|
| 160 | + .. note:: |
| 161 | +
|
| 162 | + Provide your values for the following parameters. To learn more, |
| 163 | + see the :doc:`parameter descriptions |
| 164 | + </tutorial/manage-database-users-scram>`. |
| 165 | +
|
| 166 | + For a cleartext password, create and save the following YAML file: |
| 167 | +
|
| 168 | + .. code-block:: sh |
| 169 | +
|
| 170 | + apiVersion: v1 |
| 171 | + kind: Secret |
| 172 | + metadata: |
| 173 | + name: mms-user-1-password |
| 174 | + # corresponds to user.spec.passwordSecretKeyRef.name |
| 175 | + type: Opaque |
| 176 | + stringData: |
| 177 | + password: <my-plain-text-password> |
| 178 | + # corresponds to user.spec.passwordSecretKeyRef.key |
| 179 | + |
| 180 | + For a Base64-encoded password, create and save the following YAML |
| 181 | + file: |
| 182 | +
|
| 183 | + .. code-block:: sh |
| 184 | +
|
| 185 | + apiVersion: v1 |
| 186 | + kind: Secret |
| 187 | + metadata: |
| 188 | + name: mms-user-1-password |
| 189 | + # corresponds to user.spec.passwordSecretKeyRef.name |
| 190 | + type: Opaque |
| 191 | + data: |
| 192 | + password: <base-64-encoded-password> |
| 193 | + # corresponds to user.spec.passwordSecretKeyRef.key |
| 194 | +
|
| 195 | +--- |
| 196 | +stepnum: 9 |
| 197 | +level: 4 |
| 198 | +title: "Create a database user." |
| 199 | +ref: add-k8s-user-configmap-kind |
| 200 | +content: | |
| 201 | +
|
| 202 | + Run the following command: |
| 203 | +
|
| 204 | + .. code-block:: sh |
| 205 | +
|
| 206 | + cat <<EOF | kubectl apply -f - |
| 207 | + apiVersion: mongodb.com/v1 |
| 208 | + kind: MongoDBUser |
| 209 | + metadata: |
| 210 | + name: mms-scram-user-1 |
| 211 | + spec: |
| 212 | + passwordSecretKeyRef: |
| 213 | + name: mms-user-1-password |
| 214 | + # Match to metadata.name of the User Secret |
| 215 | + key: password |
| 216 | + username: "mms-scram-user-1" |
| 217 | + db: "admin" # |
| 218 | + mongodbResourceRef: |
| 219 | + name: "demo-mongodb-cluster-1" |
| 220 | + # Match to MongoDB resource using authenticaiton |
| 221 | + roles: |
| 222 | + - db: "admin" |
| 223 | + name: "clusterAdmin" |
| 224 | + - db: "admin" |
| 225 | + name: "userAdminAnyDatabase" |
| 226 | + - db: "admin" |
| 227 | + name: "readWrite" |
| 228 | + - db: "admin" |
| 229 | + name: "userAdminAnyDatabase" |
| 230 | + EOF |
| 231 | +
|
| 232 | +--- |
| 233 | +stepnum: 10 |
| 234 | +level: 4 |
| 235 | +ref: view-k8s-user-kind |
| 236 | +optional: true |
| 237 | +source: |
| 238 | + file: steps-add-database-user-scram.yaml |
| 239 | + ref: view-k8s-user |
| 240 | + |
| 241 | +--- |
| 242 | +stepnum: 11 |
| 243 | +level: 4 |
| 244 | +title: "Connect to the :term:`replica set`." |
| 245 | +ref: connect-k8s-rs-kind |
| 246 | +content: | |
| 247 | +
|
| 248 | + Perform the following steps in the |mms| or |
| 249 | + `Cloud Manager <docs.cloudmanager.com/current/>`__ |
| 250 | + application, depending on where your clusters are hosted: |
| 251 | +
|
| 252 | + 1. Click :guilabel:`Deployment` in the left navigation. |
| 253 | +
|
| 254 | + #. Click :icon-mms:`ellipsis` for the deployment to which you want |
| 255 | + to connect. |
| 256 | + |
| 257 | + #. Click :guilabel:`Connect to this instance`. |
| 258 | +
|
| 259 | + #. Run the connection command in a terminal to connect to the |
| 260 | + deployment. |
| 261 | +
|
| 262 | +... |
0 commit comments