Skip to content

Commit 3c13ab1

Browse files
authored
Merge pull request #80110 from dfitzmau/OSDOCS-9350-deepdive-3
OSDOCS-9350-deepdive-3: endpointPublishingStrategy updates
2 parents 563490b + c9d8a85 commit 3c13ab1

13 files changed

+217
-45
lines changed

_topic_maps/_topic_map.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,9 +1372,6 @@ Topics:
13721372
- Name: Configuring the Ingress Controller for manual DNS management
13731373
File: ingress-controller-dnsmgt
13741374
Distros: openshift-enterprise,openshift-origin
1375-
- Name: Configuring the Ingress Controller endpoint publishing strategy
1376-
File: nw-configuring-ingress-controller-endpoint-publishing-strategy
1377-
Distros: openshift-enterprise,openshift-origin
13781375
- Name: Verifying connectivity to an endpoint
13791376
File: verifying-connectivity-endpoint
13801377
- Name: Changing the cluster network MTU
@@ -1557,6 +1554,9 @@ Topics:
15571554
Distros: openshift-enterprise,openshift-origin
15581555
- Name: Configuring ingress cluster traffic using an Ingress Controller
15591556
File: configuring-ingress-cluster-traffic-ingress-controller
1557+
- Name: Configuring the Ingress Controller endpoint publishing strategy
1558+
File: nw-configuring-ingress-controller-endpoint-publishing-strategy
1559+
Distros: openshift-enterprise,openshift-origin
15601560
- Name: Configuring ingress cluster traffic using a load balancer
15611561
File: configuring-ingress-cluster-traffic-load-balancer
15621562
Distros: openshift-enterprise,openshift-origin

machine_management/control_plane_machine_management/cpmso_provider_configurations/cpmso-config-options-aws.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ include::modules/private-clusters-setting-api-private.adoc[leveloffset=+2]
3030

3131
[role="_additional-resources"]
3232
.Additional resources
33-
* xref:../../../networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.adoc#nw-ingresscontroller-change-internal_configuring-ingress-cluster-traffic-ingress-controller[Configuring the Ingress Controller endpoint publishing scope to Internal]
33+
* xref:../../../networking/configuring_ingress_cluster_traffic/nw-configuring-ingress-controller-endpoint-publishing-strategy.adoc#nw-ingresscontroller-change-internal_nw-configuring-ingress-controller-endpoint-publishing-strategy[Configuring the Ingress Controller endpoint publishing scope to Internal]
3434

3535
//Selecting a larger Amazon Web Services instance type for control plane machines
3636
include::modules/cpms-changing-aws-instance-type.adoc[leveloffset=+2]

machine_management/control_plane_machine_management/cpmso_provider_configurations/cpmso-config-options-azure.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ You can enable features by updating values in the control plane machine set.
2828
include::modules/private-clusters-setting-api-private.adoc[leveloffset=+2]
2929
[role="_additional-resources"]
3030
.Additional resources
31-
* xref:../../../networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.adoc#nw-ingresscontroller-change-internal_configuring-ingress-cluster-traffic-ingress-controller[Configuring the Ingress Controller endpoint publishing scope to Internal]
31+
* xref:../../../networking/configuring_ingress_cluster_traffic/nw-configuring-ingress-controller-endpoint-publishing-strategy.adoc#nw-ingresscontroller-change-internal_nw-configuring-ingress-controller-endpoint-publishing-strategy[Configuring the Ingress Controller endpoint publishing scope to Internal]
3232

3333
//Selecting an Azure Marketplace image
3434
include::modules/installation-azure-marketplace-subscribe.adoc[leveloffset=+2]

modules/hcp-virt-wildcard-dns.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[id="hcp-virt-wildcard-dns_{context}"]
77
= Setting up a wildcard DNS
88

9-
Set up up a wildcard DNS record or CNAME that references the external IP of the load balancer service.
9+
Set up a wildcard DNS record or CNAME that references the external IP of the load balancer service.
1010

1111
.Procedure
1212

modules/nw-creating-project-and-service.adoc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66
[id="nw-creating-project-and-service_{context}"]
77
= Creating a project and service
88

9-
If the project and service that you want to expose do not exist, first create
10-
the project, then the service.
9+
If the project and service that you want to expose does not exist, create the project and then create the service.
1110

12-
If the project and service already exist, skip to the procedure on exposing the
13-
service to create a route.
11+
If the project and service already exists, skip to the procedure on exposing the service to create a route.
1412

1513
.Prerequisites
1614

17-
* Install the `oc` CLI and log in as a cluster administrator.
15+
* Install the {oc-first} and log in as a cluster administrator.
1816
1917
.Procedure
2018

2119
. Create a new project for your service by running the `oc new-project` command:
2220
+
2321
[source,terminal]
2422
----
25-
$ oc new-project myproject
23+
$ oc new-project <project_name>
2624
----
2725

2826
. Use the `oc new-app` command to create your service:
@@ -36,7 +34,7 @@ $ oc new-app nodejs:12~https://github.com/sclorg/nodejs-ex.git
3634
+
3735
[source,terminal]
3836
----
39-
$ oc get svc -n myproject
37+
$ oc get svc -n <project_name>
4038
----
4139
+
4240
.Example output
@@ -46,4 +44,7 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
4644
nodejs-ex ClusterIP 172.30.197.157 <none> 8080/TCP 70s
4745
----
4846
+
47+
[NOTE]
48+
====
4949
By default, the new service does not have an external IP address.
50+
====

modules/nw-exposing-service.adoc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ endif::[]
1212

1313
You can expose the service as a route by using the `oc expose` command.
1414

15-
.Procedure
15+
.Prerequisites
1616

17-
To expose the service:
17+
* You logged into {product-title}.
1818
19-
. Log in to {product-title}.
19+
.Procedure
2020

2121
. Log in to the project where the service you want to expose is located:
2222
+
2323
[source,terminal]
2424
----
25-
$ oc project myproject
25+
$ oc project <project_name>
2626
----
2727

2828
ifndef::nodeport[]
@@ -40,9 +40,9 @@ $ oc expose service nodejs-ex
4040
route.route.openshift.io/nodejs-ex exposed
4141
----
4242

43-
. To verify that the service is exposed, you can use a tool, such as cURL, to make sure the service is accessible from outside the cluster.
43+
. To verify that the service is exposed, you can use a tool, such as `curl` to check that the service is accessible from outside the cluster.
4444

45-
.. Use the `oc get route` command to find the route's host name:
45+
.. To find the hostname of the route, enter the following command:
4646
+
4747
[source,terminal]
4848
----
@@ -56,8 +56,9 @@ NAME HOST/PORT PATH SERVICES PORT TERMI
5656
nodejs-ex nodejs-ex-myproject.example.com nodejs-ex 8080-tcp None
5757
----
5858

59-
.. Use cURL to check that the host responds to a GET request:
59+
.. To check that the host responds to a GET request, enter the following command:
6060
+
61+
.Example `curl` command
6162
[source,terminal]
6263
----
6364
$ curl --head nodejs-ex-myproject.example.com

modules/nw-ingress-controller-endpoint-publishing-strategies.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-nodeport.adoc
3+
// * networking/nw-configuring-ingress-controller-endpoint-publishing-strategy.adoc
44

55
:_mod-docs-content-type: CONCEPT
66
[id="nw-ingress-controller-endpoint-publishing-strategies_{context}"]
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * networking/configuring_ingress_cluster_traffic/nw-configuring-ingress-controller-endpoint-publishing-strategy.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="nw-ingress-controller-nodeportservice-projects_{context}"]
7+
= Adding a single NodePort service to an Ingress Controller
8+
9+
Instead of creating a `NodePort`-type `Service` for each project, you can create a custom Ingress Controller to use the `NodePortService` endpoint publishing strategy. To prevent port conflicts, consider this configuration for your Ingress Controller when you want to apply a set of routes, through Ingress sharding, to nodes that might already have a `HostNetwork` Ingress Controller.
10+
11+
Before you set a `NodePort`-type `Service` for each project, read the following considerations:
12+
13+
* You must create a wildcard DNS record for the Nodeport Ingress Controller domain. A Nodeport Ingress Controller route can be reached from the address of a worker node. For more information about the required DNS records for routes, see "User-provisioned DNS requirements".
14+
* You must expose a route for your service and specify the `--hostname` argument for your custom Ingress Controller domain.
15+
* You must append the port that is assigned to the `NodePort`-type `Service` in the route so that you can access application pods.
16+
17+
.Prerequisites
18+
19+
* You installed the {oc-first}.
20+
* Logged in as a user with `cluster-admin` privileges.
21+
* You created a wildcard DNS record.
22+
// https://docs.openshift.com/container-platform/4.16/networking/ingress-controller-dnsmgt.html (does not detail how to create the DNS)
23+
24+
.Procedure
25+
26+
. Create a custom resource (CR) file for the Ingress Controller:
27+
+
28+
.Example of a CR file that defines information for the `IngressController` object
29+
[source,yaml]
30+
----
31+
apiVersion: v1
32+
items:
33+
- apiVersion: operator.openshift.io/v1
34+
kind: IngressController
35+
metadata:
36+
name: <custom_ic_name> <1>
37+
namespace: openshift-ingress-operator
38+
spec:
39+
replicas: 1
40+
domain: <custom_ic_domain_name> <2>
41+
nodePlacement:
42+
nodeSelector:
43+
matchLabels:
44+
<key>: <value> <3>
45+
namespaceSelector:
46+
matchLabels:
47+
<key>: <value> <4>
48+
endpointPublishingStrategy:
49+
type: NodePortService
50+
# ...
51+
----
52+
<1> Specify the a custom `name` for the `IngressController` CR.
53+
<2> The DNS name that the Ingress Controller services. As an example, the default ingresscontroller domain is `apps.ipi-cluster.example.com`, so you would specify the `<custom_ic_domain_name>` as `nodeportsvc.ipi-cluster.example.com`.
54+
<3> Specify the label for the nodes that include the custom Ingress Controller.
55+
<4> Specify the label for a set of namespaces. Substitute `<key>:<value>` with a map of key-value pairs where `<key>` is a unique name for the new label and `<value>` is its value. For example: `ingresscontroller: custom-ic`.
56+
57+
. Add a label to a node by using the `oc label node` command:
58+
+
59+
[source,terminal]
60+
----
61+
$ oc label node <node_name> <key>=<value> <1>
62+
----
63+
<1> Where `<value>` must match the key-value pair specified in the `nodePlacement` section of your `IngressController` CR.
64+
65+
. Create the `IngressController` object:
66+
+
67+
[source,terminal]
68+
----
69+
$ oc create -f <ingress_controller_cr>.yaml
70+
----
71+
72+
. Find the port for the service created for the `IngressController` CR:
73+
+
74+
[source,terminal]
75+
----
76+
$ oc get svc -n openshift-ingress
77+
----
78+
+
79+
.Example output that shows port `80:32432/TCP` for the `router-nodeport-custom-ic3` service
80+
[source,terminal]
81+
----
82+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
83+
router-internal-default ClusterIP 172.30.195.74 <none> 80/TCP,443/TCP,1936/TCP 223d
84+
router-nodeport-custom-ic3 NodePort 172.30.109.219 <none> 80:32432/TCP,443:31366/TCP,1936:30499/TCP 155m
85+
----
86+
87+
. To create a new project, enter the following command:
88+
+
89+
[source,terminal]
90+
----
91+
$ oc new-project <project_name>
92+
----
93+
94+
. To label the new namespace, enter the following command:
95+
+
96+
[source,terminal]
97+
----
98+
$ oc label namespace <project_name> <key>=<value> <1>
99+
----
100+
<1> Where `<key>=<value>` must match the value in the `namespaceSelector` section of your Ingress Controller CR.
101+
102+
. Create a new application in your cluster:
103+
+
104+
[source,terminal]
105+
----
106+
$ oc new-app --image=<image_name> <1>
107+
----
108+
<1> An example of `<image_name>` is `quay.io/openshifttest/hello-openshift:multiarch`.
109+
110+
. Create a `Route` object for a service, so that the pod can use the service to expose the application external to the cluster.
111+
+
112+
[source,terminal]
113+
----
114+
$ oc expose svc/<service_name> --hostname=<svc_name>-<project_name>.<custom_ic_domain_name> <1>
115+
----
116+
+
117+
[NOTE]
118+
====
119+
You must specify the domain name of your custom Ingress Controller in the `--hostname` argument. If you do not do this, the Ingress Operator uses the default Ingress Controller to serve all the routes for your cluster.
120+
====
121+
122+
. Check that the route has the `Admitted` status and that it includes metadata for the custom Ingress Controller:
123+
+
124+
[source,terminal,subs="quotes,attributes"]
125+
----
126+
$ oc get route/hello-openshift -o json | jq '.status.ingress'
127+
----
128+
+
129+
.Example output
130+
[source,terminal]
131+
----
132+
# ...
133+
{
134+
"conditions": [
135+
{
136+
"lastTransitionTime": "2024-05-17T18:25:41Z",
137+
"status": "True",
138+
"type": "Admitted"
139+
}
140+
],
141+
[
142+
{
143+
"host": "hello-openshift.nodeportsvc.ipi-cluster.example.com",
144+
"routerCanonicalHostname": "router-nodeportsvc.nodeportsvc.ipi-cluster.example.com",
145+
"routerName": "nodeportsvc", "wildcardPolicy": "None"
146+
}
147+
],
148+
}
149+
----
150+
151+
. Update the default `IngressController` CR to prevent the default Ingress Controller from managing the `NodePort`-type `Service`. The default Ingress Controller will continue to monitor all other cluster traffic.
152+
+
153+
[source,terminal]
154+
----
155+
$ oc patch --type=merge -n openshift-ingress-operator ingresscontroller/default --patch '{"spec":{"namespaceSelector":{"matchExpressions":[{"key":"<key>","operator":"NotIn","values":["<value>]}]}}}'
156+
----
157+
158+
.Verification
159+
160+
. Verify that the DNS entry can route inside and outside of your cluster by entering the following command. The command outputs the IP address of the node that received the label from running the `oc label node` command earlier in the procedure.
161+
+
162+
[source,terminal]
163+
----
164+
$ dig +short <svc_name>-<project_name>.<custom_ic_domain_name>
165+
----
166+
167+
. To verify that your cluster uses the IP addresses from external DNS servers for DNS resolution, check the connection of your cluster by entering the following command:
168+
+
169+
[source,terminal]
170+
----
171+
$ curl <svc_name>-<project_name>.<custom_ic_domain_name>:<port> <1>
172+
----
173+
<1> Where `<port>` is the node port from the `NodePort`-type `Service`. Based on example output from the `oc get svc -n openshift-ingress` command, the `80:32432/TCP` HTTP route means that `32432` is the node port.
174+
+
175+
.Output example
176+
+
177+
[source,terminal]
178+
----
179+
Hello OpenShift!
180+
----

networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.adoc

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ to a user, run the following command:
3232
$ oc adm policy add-cluster-role-to-user cluster-admin username
3333
----
3434

35-
* Have an {product-title} cluster with at least one master and at least one node
35+
* You have an {product-title} cluster with at least one master and at least one node
3636
and a system outside the cluster that has network access to the cluster. This
3737
procedure assumes that the external system is on the same subnet as the cluster.
3838
The additional networking required for external systems on a different subnet is
@@ -45,9 +45,7 @@ include::modules/nw-creating-project-and-service.adoc[leveloffset=+1]
4545
// Exposing the service by creating a route
4646
include::modules/nw-exposing-service.adoc[leveloffset=+1]
4747

48-
// Router sharding
4948
ifdef::openshift-enterprise,openshift-webscale,openshift-origin[]
50-
5149
// Ingress sharding in OpenShift Container Platform
5250
include::modules/nw-ingress-sharding-concept.adoc[leveloffset=+1]
5351

@@ -89,18 +87,3 @@ include::modules/nw-ingress-sharding-route-configuration.adoc[leveloffset=+2]
8987

9088
* xref:../../networking/network_security/network_policy/about-network-policy.adoc#about-network-policy[About network policy]
9189
endif::openshift-enterprise,openshift-webscale,openshift-origin[]
92-
93-
// Ingress Controller endpoint publishing strategy
94-
include::modules/nw-ingress-controller-endpoint-publishing-strategies.adoc[leveloffset=+1]
95-
96-
// Configuring the Ingress Controller endpoint publishing scope to Internal
97-
include::modules/nw-ingresscontroller-change-internal.adoc[leveloffset=+2]
98-
99-
// Configuring the Ingress Controller endpoint publishing scope to External
100-
include::modules/nw-ingresscontroller-change-external.adoc[leveloffset=+2]
101-
102-
[discrete]
103-
[id="additional-resources_nw-ingress-controller-endpoint-publishing-strategies"]
104-
=== Additional resources
105-
106-
* xref:../networking/ingress-operator#nw-ingress-controller-configuration-parameters_configuring-ingress[Ingress Controller configuration parameters]

networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-nodeport.adoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
:_mod-docs-content-type: ASSEMBLY
22
[id="configuring-ingress-cluster-traffic-nodeport"]
3-
= Configuring ingress cluster traffic using a NodePort
3+
= Configuring ingress cluster traffic by using a NodePort
44
include::_attributes/common-attributes.adoc[]
55
:context: configuring-ingress-cluster-traffic-nodeport
66

@@ -38,13 +38,16 @@ procedure assumes that the external system is on the same subnet as the cluster.
3838
The additional networking required for external systems on a different subnet is
3939
out-of-scope for this topic.
4040

41+
// Creating a project and service
4142
include::modules/nw-creating-project-and-service.adoc[leveloffset=+1]
4243

44+
// Exposing the service by creating a route
4345
include::modules/nw-exposing-service.adoc[leveloffset=+1]
4446

45-
4647
[role="_additional-resources"]
4748
[id="configuring-ingress-cluster-traffic-nodeport-additional-resources"]
4849
== Additional resources
4950

5051
* xref:../../networking/configuring-node-port-service-range.adoc#configuring-node-port-service-range[Configuring the node port service range]
52+
53+
* xref:../../networking/configuring_ingress_cluster_traffic/nw-configuring-ingress-controller-endpoint-publishing-strategy.adoc#nw-ingress-controller-nodeportservice-projects_nw-configuring-ingress-controller-endpoint-publishing-strategy[Adding a single NodePort service to an Ingress Controller]

0 commit comments

Comments
 (0)