Skip to content

Commit 4738e11

Browse files
davidhou17jwilliams-mongo
authored andcommitted
(DOCSP-27822): Update external connectivity tutorial with steps to configure externalAccess (#1267)
* Update tutorial with steps to configure externalAccess copy review 1 tech review feedback revise wording final updates * resolve merge conflicts
1 parent 90bf204 commit 4738e11

7 files changed

+160
-119
lines changed

source/includes/facts/fact-external-access-spec.rst

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,4 @@ that match the external service to a specific Pod.
66
If you add this setting without any values, the |k8s-op-short| creates
77
an external service with the following default values:
88

9-
.. list-table::
10-
:header-rows: 1
11-
:widths: 30 25 45
12-
13-
* - Field
14-
- Value
15-
- Description
16-
17-
* - ``Name``
18-
- ``<pod-name>-svc-external``
19-
- Name of the external service. You can't change this value.
20-
21-
* - ``Type``
22-
- ``LoadBalancer``
23-
- Creates an external :k8sdocs:`LoadBalancer
24-
</concepts/services-networking/service/#loadbalancer>` service.
25-
26-
* - ``Port``
27-
- ``<Port Number>``
28-
- A port for |mongod|. If you set |external-domain|,
29-
the external service adds another port (``Port Number + 1``) for backups.
30-
31-
* - ``publishNotReadyAddress``
32-
- ``true``
33-
- Specifies that :k8sdocs:`DNS records </concepts/services-networking/dns-pod-service/>`
34-
are created even if the Pod isn't ready.
35-
Do not set to ``false`` for any database Pod.
36-
9+
.. include:: /includes/list-tables/external-service-default.rst
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. list-table::
2+
:header-rows: 1
3+
:widths: 30 25 45
4+
5+
* - Field
6+
- Value
7+
- Description
8+
9+
* - ``Name``
10+
- ``<pod-name>-svc-external``
11+
- Name of the external service. You can't change this value.
12+
13+
* - ``Type``
14+
- ``LoadBalancer``
15+
- Creates an external :k8sdocs:`LoadBalancer
16+
</concepts/services-networking/service/#loadbalancer>` service.
17+
18+
* - ``Port``
19+
- ``<Port Number>``
20+
- A port for |mongod|. If you set |external-domain|,
21+
the external service adds another port (``Port Number + 1``) for backups.
22+
23+
* - ``publishNotReadyAddress``
24+
- ``true``
25+
- Specifies that :k8sdocs:`DNS records </concepts/services-networking/dns-pod-service/>`
26+
are created even if the Pod isn't ready.
27+
Do not set to ``false`` for any database Pod.
28+

source/includes/steps-enable-split-horizon-openshift.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ stepnum: 4
8181
ref: remove-tls-existing-replica-sets-openshift
8282
source:
8383
file: steps-enable-split-horizon.yaml
84-
ref: remove-tls-existing-replicasets
84+
ref: add-san-to-cert
8585

8686
---
8787
title: "Open your replica set resource |yaml| file."

source/includes/steps-enable-split-horizon.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ content: |
1717
title: "Add Subject Alternate Names to your |tls| certificates."
1818
level: 4
1919
stepnum: 2
20-
ref: remove-tls-existing-replicasets
20+
ref: add-san-to-cert
2121
content: |
2222
2323
Add each external |dns| name to the certificate |san-dns|.

source/includes/steps-multi-cluster-enable-split-horizon.yaml

Lines changed: 117 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ content: |
99
title: ":ref:`Secure the Multi-Kubernetes Cluster with TLS <multi-cluster-secure-tls>`."
1010
level: 4
1111
stepnum: 2
12-
ref: enable-tls--replicaset
12+
ref: enable-tls-replicaset
1313
content: |
1414
1515
Provide values for:
@@ -18,79 +18,143 @@ content: |
1818
- The custom |certauth| certificate in :setting:`spec.security.tls.ca`.
1919
2020
---
21-
title: "Add Subject Alternate Names to your |tls| certificates."
21+
title: "Create an external service for each of the Pods in different clusters."
2222
level: 4
2323
stepnum: 3
24-
ref: remove-tls-existing-replicasets
24+
ref: external-services-replicaset
2525
content: |
2626
27-
Add each external |dns| name to the certificate |san-dns|.
27+
To connect to your |multi-cluster| from an external resource, configure the
28+
:ref:`spec.externalAccess <multi-spec-externalaccess>` setting:
29+
30+
.. code-block:: yaml
31+
32+
externalAccess: {}
33+
34+
This setting instructs the |k8s-op-short| to create an external :k8sdocs:`LoadBalancer
35+
</concepts/services-networking/service/#loadbalancer>` service for each Pod in your
36+
|multi-cluster|. The external service provides an entry point for external connections.
37+
Adding this setting with no values creates an external service with the following default
38+
values:
39+
40+
.. include:: /includes/list-tables/external-service-default.rst
41+
42+
Optionally, if you need to add values to the service or override the default values,
43+
specify:
44+
45+
- Annotations specific to your cloud provider, in :ref:`spec.externalAccess.externalService.annotations
46+
<multi-spec-externalaccess-externalservice-annotations>`.
47+
48+
- Overrides for the service specification, in :ref:`spec.externalAccess.externalService.spec
49+
<multi-spec-externalaccess-externalservice-spec>`.
50+
51+
For example, the following settings override the default values for the external service
52+
to configure your |multi-cluster| to create a :k8sdocs:`NodePort service
53+
</concepts/services-networking/service/#type-nodeport>` that exposes the |multi-cluster|:
54+
55+
.. code-block:: yaml
56+
57+
externalAccess:
58+
externalService:
59+
annotations:
60+
# cloud-specific annotations for the service
61+
spec:
62+
type: NodePort # default is LoadBalancer
63+
port: 27017
64+
# you can specify other spec overrides if necessary
65+
66+
.. tip::
67+
68+
To learn more, see
69+
:k8sdocs:`Annotations </concepts/overview/working-with-objects/annotations/>`
70+
and :k8sdocs:`ServiceSpec </reference/kubernetes-api/service-resources/service-v1/#ServiceSpec>`
71+
in the |k8s| documentation.
2872
2973
---
30-
title: "Create a ``NodePort`` service for each of the Pods in different clusters."
74+
title: "Configure an external service for cluster members."
3175
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
76+
stepnum: 3
77+
optional: true
78+
ref: external-services-override-replicaset
79+
content: |
80+
81+
If you need to configure settings for a specific cluster member,
82+
such as when you're hosting members on different cloud providers,
83+
you can override the global :ref:`spec.externalAccess <multi-spec-externalaccess>`
84+
settings for a specific member by using the :ref:`spec.clusterSpecList.externalAccess.externalService
85+
<multi-spec-clusterspeclist-externalservice>` setting.
86+
87+
To add values to the service or override the default values for a
88+
cluster member, specify:
89+
90+
- Annotations specific to the cloud provider for the cluster member, in
91+
:ref:`spec.clusterSpecList.externalAccess.externalService.annotations
92+
<multi-spec-clusterspeclist-annotations>`.
93+
94+
- Overrides specific to the cluster member, in :ref:`spec.clusterSpecList.externalAccess.externalService.spec
95+
<multi-spec-clusterspeclist-spec>`.
96+
97+
For example, the following file configures your |multi-cluster| to
98+
create load balancer services that expose the |multi-cluster| for
99+
cluster members deployed in |gke| and |aws| :aws:`EKS </eks/latest/userguide/what-is-eks>`.
100+
101+
.. note::
102+
103+
The following example doesn't configure overrides, so the external services
104+
use the default values from the :ref:`spec.externalAccess <multi-spec-externalaccess>`
105+
setting.
106+
107+
.. code-block:: yaml
108+
109+
clusterSpecList:
110+
- clusterName: gke-cluster-0.mongokubernetes.com
111+
members: 2
112+
externalAccess:
113+
externalService:
114+
annotations:
115+
"cloud.google.com/l4-rbs": "enabled"
116+
- clusterName: eks-cluster-1.mongokubernetes.com
117+
members: 2
118+
externalAccess:
119+
externalService:
120+
annotations:
121+
"service.beta.kubernetes.io/aws-load-balancer-type": "external",
122+
"service.beta.kubernetes.io/aws-load-balancer-nlb-target-type": "instance",
123+
"service.beta.kubernetes.io/aws-load-balancer-scheme": "internet-facing"
70124
125+
---
126+
title: "Add Subject Alternate Names to your |tls| certificate."
127+
level: 4
128+
stepnum: 3
129+
ref: add-san-to-cert
130+
content: |
71131
72-
Apply the YAML with ``kubectl apply -f <nodeport-conf>.yaml``.
132+
Add each external |dns| name to the certificate |san-dns|.
73133
74134
---
75-
title: "Verify the NodePort services."
135+
title: "Verify the external services."
76136
level: 4
77137
stepnum: 5
78-
ref: k8s-ext-rs-discover-nodeports
138+
ref: k8s-verify-external-services
79139
content: |
80140
81-
In each cluster, run this command to verify the NodePort services that
82-
you created:
141+
In each cluster, run the following command to verify that the external services
142+
have been created.
83143
84144
.. code-block:: sh
85145
86-
$ kubectl get svc <node_port_service_name>
146+
$ kubectl get services
87147
88-
The command returns results similar to the following example:
148+
The command returns a list of services similar to the following output.
149+
For each database Pod in the cluster, the |k8s-op-short| creates an external service
150+
named ``<pod-name>-svc-external``. This service is configured according to the values
151+
and overrides you provide in the external service specification.
89152
90153
.. code-block:: sh
154+
:copyable: false
91155
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
156+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
157+
my-replica-set-0-0-svc-external LoadBalancer 10.102.27.116 1.2.3.4 27017:27017/TCP 8m30s
94158
95159
---
96160
title: "Update your replica set resource |yaml| file."
@@ -100,7 +164,7 @@ ref: update-replset-resource-mc-split-horizon
100164
content: |
101165
102166
Set the hostnames and ports in :setting:`spec.connectivity.replicaSetHorizons`
103-
to the NodePort values that you created in the previous step.
167+
to the LoadBalancer values that you created in the previous step.
104168
105169
Confirm that you specified the correct external hostnames. External
106170
hostnames should match the |dns| names of |k8s| worker nodes.

source/reference/k8s-operator-multi-cluster-specification.txt

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -380,42 +380,7 @@ Optional ``MongoDBMultiCluster`` Resource Settings
380380

381381
.. |hostname-example| replace:: ``multi-replica-set-0-1.cluster-0.example.com``
382382

383-
<<<<<<< HEAD
384-
<<<<<<< HEAD
385-
When you add a top-level domain, ``processes[n].hostname`` in the :opsmgr:`automation configuration </reference/cluster-configuration/>`
386-
creates a value that is a subdomain of this top-level domain in the format ``<replica-set-name>-<cluster-idx>-<pod-idx>.<externalDomain>``.
387-
For example, ``multi-replica-set-0-1.cluster-0.example.com``. The {+mdbagent+} uses this
388-
hostname to connect to |mongod|.
389-
=======
390-
When you add a top-level domain, the ``processes[n].hostname`` field in the
391-
:opsmgr:`automation configuration </reference/cluster-configuration>`
392-
creates a value that contains the subdomain of the top-level domain in the
393-
following format:
394-
395-
.. code-block:: none
396-
:copyable: false
397-
398-
<replica-set-name>-<cluster-idx>-<pod-idx>.<externalDomain>
399-
400-
For example:
401-
402-
.. code-block:: none
403-
:copyable: false
404-
405-
multi-replica-set-0-1.cluster-0.example.com
406-
407-
The {+mdbagent+} uses this hostname to connect to |mongod|.
408-
>>>>>>> 2d7ac81 (reconcile changes against multi-cluster spec)
409-
410-
.. warning::
411-
412-
Specifying this field changes how |mongod| processes are registered in |onprem|.
413-
You can only specify this field for new deployments. You can't change
414-
the value of this field or any ``processes[n].hostname`` fields in the automation
415-
configuration for a running deployment.
416-
=======
417383
.. include:: /includes/facts/fact-external-domain-spec.rst
418-
>>>>>>> 68d53a6 (copy and tech review feedback 1)
419384

420385
.. important::
421386

@@ -452,6 +417,7 @@ Optional ``MongoDBMultiCluster`` Resource Settings
452417
*Type*: collection
453418

454419
Configuration for the :k8sdocs:`ServiceSpec </reference/kubernetes-api/service-resources/service-v1/#ServiceSpec>`.
420+
For more information, see :ref:`spec.clusterSpecList.externalAccess.externalService <multi-spec-clusterspeclist-externalservice>`.
455421

456422
.. _multi-spec-clusterspeclist-memberconfig:
457423

@@ -571,7 +537,7 @@ Optional ``MongoDBMultiCluster`` Resource Settings
571537
:ref:`spec.clusterSpecList.externalAccess.externalService
572538
<multi-spec-clusterspeclist-externalservice>`.
573539

574-
.. |external-domain| replace:: ref:`spec.clusterSpecList.externalAccess.externalDomain <multi-spec-clusterspeclist-externaldomain>`
540+
.. |external-domain| replace:: :ref:`spec.clusterSpecList.externalAccess.externalDomain <multi-spec-clusterspeclist-externaldomain>`
575541

576542
.. include:: /includes/facts/fact-external-access-spec.rst
577543

@@ -598,6 +564,14 @@ Optional ``MongoDBMultiCluster`` Resource Settings
598564
in the |k8s| documentation and the documentation for the cloud provider you use
599565
for |k8s| deployments.
600566

567+
.. _multi-spec-externalaccess-externalservice-spec:
568+
569+
``spec.externalAccess.externalService.spec``
570+
*Type*: collection
571+
572+
Configuration for the :k8sdocs:`ServiceSpec </reference/kubernetes-api/service-resources/service-v1/#ServiceSpec>`.
573+
For more information, see :ref:`spec.externalAccess.externalService <multi-spec-externalaccess-externalservice>`.
574+
601575
.. _multi-spec-fcv:
602576

603577
``spec.featureCompatibilityVersion``

source/tutorial/multi-cluster-connect-from-outside-k8s.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ Procedure
3535
To connect to your |k8s-op-short|-deployed replica set with a |mongodb-multi|
3636
from outside of the |k8s| cluster:
3737

38+
.. |external-domain| replace:: :setting:`spec.externalAccess.externalDomain`
39+
3840
.. include:: /includes/steps/multi-cluster-enable-split-horizon.rst
3941

0 commit comments

Comments
 (0)