|
| 1 | +.. _k8s-encryption-at-rest: |
| 2 | + |
| 3 | +=================================== |
| 4 | +Configure |kmip| Encryption at Rest |
| 5 | +=================================== |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. facet:: |
| 10 | + :name: genre |
| 11 | + :values: tutorial |
| 12 | + |
| 13 | +.. contents:: On this page |
| 14 | + :local: |
| 15 | + :backlinks: none |
| 16 | + :depth: 1 |
| 17 | + :class: singlecol |
| 18 | + |
| 19 | +You can configure :manual:`encryption at rest |
| 20 | +</core/security-encryption-at-rest/>` |
| 21 | +for a MongoDB deployment managed by the |k8s-op-short| |
| 22 | +by using a |kmip| server. |
| 23 | + |
| 24 | +Considerations |
| 25 | +-------------- |
| 26 | + |
| 27 | +Before configuring encryption at rest, consider the following: |
| 28 | + |
| 29 | +- You must have a running |kmip| server. |
| 30 | +- You can't transition your deployment that uses keyfile-based encryption |
| 31 | + at rest to |kmip|-based encryption at rest. |
| 32 | +- If you want to enable |kmip| encryption at rest for an already deployed MongoDB |
| 33 | + resource, contact `MongoDB Support <https://support.mongodb.com/welcome>`_. |
| 34 | + |
| 35 | +Procedure |
| 36 | +--------- |
| 37 | + |
| 38 | +The following procedure describes how to configure |
| 39 | +a sample |kmip| configuration for a MongoDB replica set. |
| 40 | +Adjust the file names and paths, |k8s| namespace, resource names, |
| 41 | +and MongoDB version as necessary for your deployment. |
| 42 | + |
| 43 | +.. procedure:: |
| 44 | + :style: normal |
| 45 | + |
| 46 | + .. step:: Create the ConfigMap of the |certauth|. |
| 47 | + |
| 48 | + Run the following command to create a |k8s-configmap| |
| 49 | + to hold the |certauth| that signed the |kmip| server's certificate: |
| 50 | + |
| 51 | + .. code-block:: |
| 52 | + |
| 53 | + kubectl -n mongodb create configmap mongodb-kmip-certificate-authority-pem --from-file=ca.pem |
| 54 | + |
| 55 | + .. step:: Create the Secret for the Client Certificate and Private Key PEM. |
| 56 | + |
| 57 | + Run the following command to create a |k8s-secret| to hold the |
| 58 | + concatenated client certificate and private key for checking out |
| 59 | + the master key from the |kmip| server: |
| 60 | + |
| 61 | + .. code-block:: |
| 62 | + |
| 63 | + kubectl -n mongodb create secret generic mongodb-kmip-client-pem --from-file=cert.pem |
| 64 | + |
| 65 | + .. step:: Configure the deployment to use the |kmip| server. |
| 66 | + |
| 67 | + Configure the ``additionalMongodConfig`` settings |
| 68 | + in your |k8s-custom-resource| specification to use the |kmip| |
| 69 | + server. For example: |
| 70 | + |
| 71 | + .. code-block:: yaml |
| 72 | + |
| 73 | + apiVersion: mongodb.com/v1 |
| 74 | + kind: MongoDB |
| 75 | + metadata: |
| 76 | + name: kmip |
| 77 | + namespace: mongodb |
| 78 | + spec: |
| 79 | + type: ReplicaSet |
| 80 | + members: 3 |
| 81 | + backup: |
| 82 | + encryption: |
| 83 | + kmip: |
| 84 | + client: |
| 85 | + clientCertificatePrefix: "mdb" |
| 86 | + additionalMongodConfig: |
| 87 | + security: |
| 88 | + enableEncryption: true |
| 89 | + kmip: |
| 90 | + clientCertificateFile: /kmip/cert/cert.pem |
| 91 | + serverCAFile: /kmip/ca/ca.pem |
| 92 | + serverName: pykmip-server.pymongo |
| 93 | + port: 5696 |
| 94 | + featureCompatibilityVersion: '6.0' |
| 95 | + version: 6.0.14-ent |
| 96 | + opsManager: |
| 97 | + configMapRef: |
| 98 | + name: my-project |
| 99 | + credentials: my-credentials |
| 100 | + podSpec: |
| 101 | + podTemplate: |
| 102 | + spec: |
| 103 | + containers: |
| 104 | + - name: mongodb-enterprise-database |
| 105 | + volumeMounts: |
| 106 | + - name: mongodb-kmip-client-pem |
| 107 | + mountPath: /kmip/cert |
| 108 | + - name: mongodb-kmip-certificate-authority-pem |
| 109 | + mountPath: /kmip/ca |
| 110 | + volumes: |
| 111 | + - name: mongodb-kmip-client-pem |
| 112 | + secret: |
| 113 | + secretName: mongodb-kmip-client-pem |
| 114 | + - name: mongodb-kmip-certificate-authority-pem |
| 115 | + configMap: |
| 116 | + name: mongodb-kmip-certificate-authority-pem |
| 117 | + items: |
| 118 | + - key: ca.pem |
| 119 | + path: ca.pem |
| 120 | + |
| 121 | + .. important:: |
| 122 | + |
| 123 | + If you set the :opsmgrkube:`spec.backup.encryption.kmip` setting |
| 124 | + in your resource, the |api| keys linked with |
| 125 | + the value of :setting:`spec.credentials` must have the :authrole:`Global Owner` role. |
0 commit comments