Skip to content

Commit fe2fdab

Browse files
committed
OCPBUGS#11363: Expose the node port for the application
1 parent 665d441 commit fe2fdab

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

modules/nw-exposing-service.adoc

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,28 @@ HTTP/1.1 200 OK
7272

7373
endif::nodeport[]
7474
ifdef::nodeport[]
75-
. To expose a node port for the application, enter the following command. {product-title} automatically selects an available port in the `30000-32767` range.
75+
. To expose a node port for the application, modify the custom resource definition (CRD) of a service by entering the following command:
7676
+
7777
[source,terminal]
7878
----
79-
$ oc expose service nodejs-ex --type=NodePort --name=nodejs-ex-nodeport --generator="service/v2"
79+
$ oc edit svc <service_name>
8080
----
8181
+
8282
.Example output
83-
[source,terminal]
83+
[source,yaml]
8484
----
85-
service/nodejs-ex-nodeport exposed
85+
spec:
86+
ports:
87+
- name: 8443-tcp
88+
nodePort: 30327 <1>
89+
port: 8443
90+
protocol: TCP
91+
targetPort: 8443
92+
sessionAffinity: None
93+
type: NodePort <2>
8694
----
95+
<1> Optional: Specify the node port range for the application. By default, {product-title} selects an available port in the `30000-32767` range.
96+
<2> Define the service type.
8797

8898
. Optional: To confirm the service is available with a node port exposed, enter the following command:
8999
+
@@ -106,6 +116,24 @@ nodejs-ex-ingress NodePort 172.30.107.72 <none> 3306:31345/TCP
106116
----
107117
$ oc delete svc nodejs-ex
108118
----
119+
120+
.Verification
121+
122+
* To check that the service node port is updated with a port in the `30000-32767` range, enter the following command:
123+
+
124+
[source,terminal]
125+
----
126+
$ oc get svc
127+
----
128+
+
129+
In the following example output, the updated port is `30327`:
130+
+
131+
.Example output
132+
[source,terminal]
133+
----
134+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
135+
httpd NodePort 172.xx.xx.xx <none> 8443:30327/TCP 109s
136+
----
109137
endif::nodeport[]
110138
111139
//Potentially add verification step, "If a verification step is needed, it would

0 commit comments

Comments
 (0)