Skip to content

Commit 25bf61b

Browse files
authored
(DOCSP-20045) Adds includes about secret storage wherever docs talk about K8s secrets (#780)
* (DOCSP-20045) Adds includes about secret storage wherever docs talk about K8s secrets * Adds more includes * Adds tutorial to add secrets to Vault * Adds link to create vault secret in more places * Adds include file, updates other pages * Rebasing * Adds more changes to TLS pages * Includes changes from copy review * Adds YAML steps file for procedure
1 parent ba9b9e2 commit 25bf61b

26 files changed

+281
-56
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
If you're using |hashicorp-vault| as your :ref:`secret storage tool <k8s-secret-storage>`,
2+
you can :ref:`Create a Vault Secret <create-vault-secret>` instead.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
To learn about your options for secret
2+
storage, see :ref:`Configure Secret Storage <k8s-set-secret-storage-tool>`.

source/includes/list-tables/resource-keys-tls-custom-ca.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
| :setting:`.tls.certsSecretPrefix<spec.security.tls.certsSecretPrefix>`
3232
- string
3333
- Optional
34-
- If applicable, add the ``<prefix>`` of the |k8s| |k8s-secret|
34+
- If applicable, add the ``<prefix>`` of the secret
3535
name that contains your MongoDB deployment's |tls| certificates.
3636
- ``devDb``

source/includes/list-tables/rs-resource-base-options.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
* - :setting:`spec.credentials`
5959
- string
60-
- Name of the |k8s| |k8s-secret| you
60+
- Name of the secret you
6161
:ref:`created <create-k8s-secret>` as |mms| |api|
6262
authentication credentials for the |k8s-op-short| to
6363
communicate with |onprem|.

source/includes/prereqs-deploy-resource.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ following procedures:
55

66
- :ref:`create-k8s-project`
77

8-
- :ref:`create-k8s-credentials`
8+
- :ref:`create-k8s-credentials` or
9+
:ref:`configure a different secret storage tool <k8s-set-secret-storage-tool>`
910

1011
Alternatively, for |cloud|, after installing the Kubernetes Operator,
1112
you can use the |cloud-short| :cloudmgr:`UI
1213
</tutorial/nav/k8s-config-for-mdb-resource/>` to automatically generate
1314
the ConfigMap and Kubernetes secret YAML files, which you can then
14-
apply to your Kubernetes environment.
15+
apply to your Kubernetes environment.
16+
17+
.. include:: /includes/facts/fact-can-change-secret-storage-tool.rst

source/includes/steps-add-database-user-scram.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ content: |
5151
5252
* - ``spec.passwordSecretKeyRef.name``
5353
- string
54-
- ``metadata.name`` value of the |k8s-secret| that stores the
54+
- ``metadata.name`` value of the secret that stores the
5555
user's password.
5656
- ``my-resource``
5757

source/includes/steps-add-database-user-secret-scram.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ ref: paste-k8s-secret
4040
content: |
4141
a. Open your preferred text editor.
4242
b. Paste this User Secret into a new text file.
43+
44+
.. include:: /includes/facts/fact-if-use-vault.rst
45+
46+
.. include:: /includes/facts/fact-learn-more-secret-storage.rst
4347
---
4448
title: "Change the highlighted lines."
4549
level: 4

source/includes/steps-configure-om-queryable-backups.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ content: |
3636
3737
kubectl create secret generic queryable-pem --from-file=./queryable.pem
3838
39+
.. include:: /includes/facts/fact-if-use-vault.rst
40+
41+
.. include:: /includes/facts/fact-learn-more-secret-storage.rst
3942
---
4043
title: "Mount the Secret as a volume that |onprem| custom objects will use."
4144
stepnum: 4
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
stepnum: 1
3+
level: 4
4+
ref: have-keys
5+
title: "Obtain the |onprem| public and private Keys."
6+
content: |
7+
8+
Make sure you have the public and private keys for your desired
9+
|onprem| |svc-api-key|.
10+
11+
---
12+
stepnum: 2
13+
level: 4
14+
ref: create-vault-secret
15+
title: "Create the secret in |vault-short|."
16+
content: |
17+
18+
Invoke the following |vault-short| command to create your secret, replacing
19+
the variables with the values in the table:
20+
21+
.. list-table::
22+
:widths: 30 70
23+
:header-rows: 1
24+
25+
* - Placeholder
26+
- Description
27+
28+
* - {Namespace}
29+
- Label that identifies the namespace where you deployed |k8s-op-short|.
30+
31+
* - {SecretName}
32+
- Human-readable label that identifies the secret you're creating in |vault-short|.
33+
34+
* - {PublicKey}
35+
- The public key for your desired |onprem| |svc-api-key|.
36+
37+
* - {PrivateKey}
38+
- The private key for your desired |onprem| |svc-api-key|.
39+
40+
.. code-block:: sh
41+
42+
vault kv put secret/data/mongodbenterprise/operator/{Namespace}/{SecretName} publicKey={PublicKey} privateKey={PrivateKey}
43+
44+
The path in this command is the default path. You can replace ``mongodbenterprise/operator`` with
45+
your base path if you customized your |k8s-op-short| configuration.
46+
47+
---
48+
stepnum: 3
49+
level: 4
50+
ref: verify-vault-secret
51+
title: "Verify the |vault-short| secret creation was successful."
52+
content: |
53+
54+
Invoke the following |vault-short| command to verify your secret, replacing
55+
the variables with the values in the following table:
56+
57+
.. list-table::
58+
:widths: 30 70
59+
:header-rows: 1
60+
61+
* - Placeholder
62+
- Description
63+
64+
* - {Namespace}
65+
- Label that identifies the namespace where you deployed |k8s-op-short|.
66+
67+
* - {SecretName}
68+
- Human-readable label that identifies the secret you're creating in |vault-short|.
69+
70+
.. code-block:: sh
71+
72+
vault kv get secret/data/mongodbenterprise/operator/{Namespace}/{SecretName}
73+
74+
This command returns a secret description in the shell:
75+
76+
.. code-block:: sh
77+
78+
====== Metadata ======
79+
Key Value
80+
--- -----
81+
created_time 2021-12-15T17:20:22.985303Z
82+
deletion_time n/a
83+
destroyed false
84+
version 1
85+
86+
======= Data =======
87+
Key Value
88+
--- -----
89+
publicKey {PublicKey}
90+
privateKey {PrivateKey}
91+
...

source/includes/steps-deploy-k8s-opsmgr-http.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ content: |
7474
7575
* - :opsmgrkube:`spec.adminCredentials`
7676
- string
77-
- Name of the |k8s-secret| you :ref:`created <om-rsrc-prereqs>`
77+
- Name of the secret you :ref:`created <om-rsrc-prereqs>`
7878
for the |onprem| admin user.
7979
8080
.. note::
@@ -213,7 +213,7 @@ content: |
213213
| ``.s3SecretRef``
214214
| ``.``:opsmgrkube:`~spec.backup.s3Stores.s3SecretRef.name`
215215
- string
216-
- Name of the |k8s-secret| that contains the ``accessKey`` and
216+
- Name of the secret that contains the ``accessKey`` and
217217
``secretKey`` fields. The :ref:`backup-daemon` uses the
218218
values of these fields as credentials to access the |s3| or
219219
|s3|-compatible bucket.
@@ -439,8 +439,8 @@ ref: create-credentials
439439
content: |
440440
441441
If you enabled Backup, you must create an |onprem| organization,
442-
generate programmatic API keys, and create a |k8s-secret|. These
443-
activities follow the prerequisites and procedure on the
442+
generate programmatic API keys, and create a secret in your :ref:`secret-storage-tool <k8s-set-secret-storage-tool>`.
443+
These activities follow the prerequisites and procedure on the
444444
:ref:`create-k8s-credentials` page.
445445
446446
---

source/includes/steps-deploy-k8s-opsmgr-https.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inherit:
55
file: steps-configure-kubectl-namespace.yaml
66
ref: configure-kubectl-namespace
77
---
8-
title: "Create a Kubernetes secret for your certificates."
8+
title: "Create a secret for your certificates."
99
stepnum: 2
1010
ref: create-cert-secret
1111
content: |
@@ -18,6 +18,8 @@ content: |
1818
kubectl create secret tls <metadata.name>-cert \
1919
--cert=<om-tls-cert> \
2020
--key=<om-tls-key>
21+
22+
.. include:: /includes/facts/fact-if-use-vault.rst
2123
---
2224
title: "If necessary, validate your TLS Certificate."
2325
stepnum: 3

source/includes/steps-deploy-k8s-sharded-cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ content: |
113113
114114
* - :setting:`spec.credentials`
115115
- string
116-
- Name of the |k8s| |k8s-secret| you
116+
- Name of the secret you
117117
:ref:`created <create-k8s-secret>` as |mms| |api|
118118
authentication credentials for the |k8s-op-short| to
119119
communicate with |onprem|.

source/includes/steps-deploy-k8s-standalone.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ content: |
8484
8585
* - :setting:`spec.credentials`
8686
- string
87-
- Name of the |k8s| |k8s-secret| you
87+
- Name of the secret you
8888
:ref:`created <create-k8s-secret>` as |mms| |api|
8989
authentication credentials for the |k8s-op-short| to
9090
communicate with |onprem|.

source/includes/steps-source-deploy-k8s-resource.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ content: |
371371
Annotations: <none>
372372
373373
---
374-
title: "Create the |k8s-secret| for your replica set's |tls| certificate."
374+
title: "Create the secret for your replica set's |tls| certificate."
375375
stepnum: 0
376376
level: 4
377377
ref: create-rs-tls-secret
@@ -386,6 +386,10 @@ content: |
386386
--cert=<replica-set-tls-cert> \
387387
--key=<replica-set-tls-key>
388388
389+
.. include:: /includes/facts/fact-if-use-vault.rst
390+
391+
.. include:: /includes/facts/fact-learn-more-secret-storage.rst
392+
389393
---
390394
title: "Create the |k8s-secret| for your agent's X.509 certificate."
391395
stepnum: 0
@@ -402,6 +406,8 @@ content: |
402406
--cert=<agent-tls-cert> \
403407
--key=<agent-tls-key>
404408
409+
.. include:: /includes/facts/fact-if-use-vault.rst
410+
405411
---
406412
title: "Renew the |k8s-secret| for your agents' X.509 certificates."
407413
stepnum: 0
@@ -495,7 +501,7 @@ content: |
495501
kubectl create configmap custom-ca --from-file=ca-pem
496502
497503
---
498-
title: "Create the |k8s-secret| for your Shards' TLS certificates."
504+
title: "Create the secret for your Shards' TLS certificates."
499505
stepnum: 0
500506
level: 4
501507
ref: create-sc-shards-tls-secret
@@ -513,6 +519,8 @@ content: |
513519
kubectl -n mongodb create secret tls <metadata.name>-1-cert \
514520
--cert=<shard-1-tls-cert> \
515521
--key=<shard-1-tls-key>
522+
523+
.. include:: /includes/facts/fact-if-use-vault.rst
516524
---
517525
title: "Renew the |k8s-secret| for your Shards' TLS certificates."
518526
stepnum: 0
@@ -540,13 +548,13 @@ content: |
540548
kubectl apply -f -
541549
542550
---
543-
title: "Create the |k8s-secret| for your config servers' TLS certificate."
551+
title: "Create the secret for your config servers' TLS certificate."
544552
stepnum: 0
545553
level: 4
546554
ref: create-sc-config-tls-secret
547555
content: |
548556
549-
Run this ``kubectl`` command to create a new |k8s-secret| that stores
557+
Run this ``kubectl`` command to create a new secret that stores
550558
the sharded cluster config servers' certificate:
551559
552560
.. code-block:: sh
@@ -555,6 +563,8 @@ content: |
555563
--cert=<config-tls-cert> \
556564
--key=<config-tls-key>
557565
566+
.. include:: /includes/facts/fact-if-use-vault.rst
567+
558568
---
559569
title: "Renew the |k8s-secret| for your config server's TLS certificates."
560570
stepnum: 0
@@ -575,13 +585,13 @@ content: |
575585
kubectl apply -f -
576586
577587
---
578-
title: "Create the |k8s-secret| for your mongos servers' TLS certificate."
588+
title: "Create the secret for your mongos servers' TLS certificate."
579589
stepnum: 0
580590
level: 4
581591
ref: create-sc-mongos-tls-secret
582592
content: |
583593
584-
Run this ``kubectl`` command to create a new |k8s-secret| that stores
594+
Run this ``kubectl`` command to create a new secret that stores
585595
the sharded cluster |mongos| certificate:
586596
587597
.. code-block:: sh
@@ -590,6 +600,8 @@ content: |
590600
--cert=<mongos-tls-cert> \
591601
--key=<mongos-tls-key>
592602
603+
.. include:: /includes/facts/fact-if-use-vault.rst
604+
593605
---
594606
title: "Renew the |k8s-secret| for your mongos server's TLS certificates."
595607
stepnum: 0

source/includes/steps-source-deploy-om-resource.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
stepnum: 0
33
level: 4
44
ref: create-om-appdb-secret
5-
title: "Create a Secret with your Application Database |tls| certificate."
5+
title: "Create a secret with your Application Database |tls| certificate."
66
content: |
77
88
Run this ``kubectl`` command to create a new |k8s-secret| that stores
@@ -14,6 +14,10 @@ content: |
1414
--cert=<appdb-tls-cert> \
1515
--key=<appdb-tls-key>
1616
17+
.. include:: /includes/facts/fact-if-use-vault.rst
18+
19+
.. include:: /includes/facts/fact-learn-more-secret-storage.rst
20+
1721
---
1822
stepnum: 0
1923
level: 4

source/includes/steps-use-vault.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ content: |
277277
|k8s-op-short| creates
278278
- TLS secrets
279279
280-
To manually migrate secrets, `add them to Vault <https://www.vaultproject.io/docs/secrets/kv/kv-v2#usage>`__.
281-
After you add them to |vault-short|, you can remove them from |k8s|.
280+
To manually migrate or create new secrets, :ref:`add them to Vault <create-vault-secret>`.
281+
After you add them to |vault-short|, you can remove them from |k8s|.
282282
283-
All other secrets migrate automatically, and |k8s-op-short| uses
284-
|vault-short| for new secrets.
283+
All other secrets that the |k8s-op-short| creates migrate automatically, and |k8s-op-short| uses
284+
|vault-short| for new secrets. User-created secrets must be :ref:`added to Vault <create-vault-secret>`.
285285
286286
.. note::
287287

source/multi-cluster-arch.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ The |k8s-op-full| performs these actions:
7171
each member cluster corresponding to the number of replica set members
7272
in the MongoDB cluster.
7373

74+
.. include:: /includes/facts/fact-can-change-secret-storage-tool.rst
75+
7476
.. figure:: /images/multi-cluster-arch.svg
7577
:alt: Diagram showing the high-level architecture of the multi-cluster
7678
deployment across regions and availability zones using the

source/reference/k8s/example-opsmgr-minimal.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spec:
77
replicas: 1
88
version: <opsmanagerversion>
99
adminCredentials: <adminusercredentials> # Should match metadata.name
10-
# in the Kubernetes secret
10+
# in the secret
1111
# for the admin user
1212
externalConnectivity:
1313
type: LoadBalancer

source/tutorial/configure-om-queryable-backups.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ In the following procedure you:
3535
</reference/configuration/#brs.queryable.pem>` file that holds the
3636
certificatesfor accessing the backup snapshots that you intend to query.
3737

38-
- Create the Secret containing the :opsmgr:`queryable.pem
38+
- Create the secret containing the :opsmgr:`queryable.pem
3939
</reference/configuration/#brs.queryable.pem>` file.
4040

4141
- Configure a persistent volume that is attached to the |onprem|
4242
|k8s| Pod in the |k8s-op-short|.
4343

44-
- Specify the mount point for the Secret in the persistent volume's
44+
- Specify the mount point for the secret in the persistent volume's
4545
configuration.
4646

4747
- Save the |onprem| custom resource configuration and apply it.

0 commit comments

Comments
 (0)