@@ -9,7 +9,7 @@ content: |
9
9
title : " :ref:`Secure the Multi-Kubernetes Cluster with TLS <multi-cluster-secure-tls>`."
10
10
level : 4
11
11
stepnum : 2
12
- ref : enable-tls-- replicaset
12
+ ref : enable-tls-replicaset
13
13
content : |
14
14
15
15
Provide values for:
@@ -18,79 +18,143 @@ content: |
18
18
- The custom |certauth| certificate in :setting:`spec.security.tls.ca`.
19
19
20
20
---
21
- title : " Add Subject Alternate Names to your |tls| certificates ."
21
+ title : " Create an external service for each of the Pods in different clusters ."
22
22
level : 4
23
23
stepnum : 3
24
- ref : remove-tls-existing-replicasets
24
+ ref : external-services-replicaset
25
25
content : |
26
26
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.
28
72
29
73
---
30
- title : " Create a ``NodePort`` service for each of the Pods in different clusters ."
74
+ title : " Configure an external service for cluster members ."
31
75
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"
70
124
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 : |
71
131
72
- Apply the YAML with ``kubectl apply -f <nodeport-conf>.yaml`` .
132
+ Add each external |dns| name to the certificate |san-dns| .
73
133
74
134
---
75
- title : " Verify the NodePort services."
135
+ title : " Verify the external services."
76
136
level : 4
77
137
stepnum : 5
78
- ref : k8s-ext-rs-discover-nodeports
138
+ ref : k8s-verify-external-services
79
139
content : |
80
140
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.
83
143
84
144
.. code-block:: sh
85
145
86
- $ kubectl get svc <node_port_service_name>
146
+ $ kubectl get services
87
147
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.
89
152
90
153
.. code-block:: sh
154
+ :copyable: false
91
155
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
94
158
95
159
---
96
160
title : " Update your replica set resource |yaml| file."
@@ -100,7 +164,7 @@ ref: update-replset-resource-mc-split-horizon
100
164
content : |
101
165
102
166
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.
104
168
105
169
Confirm that you specified the correct external hostnames. External
106
170
hostnames should match the |dns| names of |k8s| worker nodes.
0 commit comments