Skip to content

Commit 15d2da9

Browse files
authored
Merge pull request #36417 from ctauchen/BZ-swap-sample-app
2 parents cd81bdc + 0b3364c commit 15d2da9

File tree

2 files changed

+30
-49
lines changed

2 files changed

+30
-49
lines changed

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

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,21 @@ service to create a route.
1717

1818
.Procedure
1919

20-
. Create a new project for your service:
21-
+
22-
[source,terminal]
23-
----
24-
$ oc new-project <project_name>
25-
----
26-
+
27-
For example:
20+
. Create a new project for your service by running the `oc new-project` command:
2821
+
2922
[source,terminal]
3023
----
3124
$ oc new-project myproject
3225
----
3326

34-
. Use the `oc new-app` command to create a service. For example:
27+
. Use the `oc new-app` command to create your service:
3528
+
3629
[source,terminal]
3730
----
38-
$ oc new-app \
39-
-e MYSQL_USER=admin \
40-
-e MYSQL_PASSWORD=redhat \
41-
-e MYSQL_DATABASE=mysqldb \
42-
registry.redhat.io/rhscl/mysql-80-rhel7
31+
$ oc new-app nodejs:12~https://github.com/sclorg/nodejs-ex.git
4332
----
4433

45-
. Run the following command to see that the new service is created:
34+
. To verify that the service was created, run the following command:
4635
+
4736
[source,terminal]
4837
----
@@ -52,8 +41,10 @@ $ oc get svc -n myproject
5241
.Example output
5342
[source,terminal]
5443
----
55-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
56-
mysql-80-rhel7 ClusterIP 172.30.63.31 <none> 3306/TCP 4m55s
44+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
45+
nodejs-ex ClusterIP 172.30.197.157 <none> 8080/TCP 70s
5746
----
5847
+
5948
By default, the new service does not have an external IP address.
49+
50+

modules/nw-exposing-service.adoc

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,67 +25,57 @@ $ oc project myproject
2525
----
2626

2727
ifndef::nodeport[]
28-
. Run the following command to expose the route:
29-
+
30-
[source,terminal]
31-
----
32-
$ oc expose service <service_name>
33-
----
34-
+
35-
For example:
28+
. Run the `oc expose service` command to expose the route:
3629
+
30+
3731
[source,terminal]
3832
----
39-
$ oc expose service mysql-80-rhel7
33+
$ oc expose service nodejs-ex
4034
----
4135
+
4236
.Example output
4337
[source,terminal]
4438
----
45-
route "mysql-80-rhel7" exposed
39+
route.route.openshift.io/nodejs-ex exposed
4640
----
4741

48-
. Use a tool, such as cURL, to make sure you can reach the service using the
49-
cluster IP address for the service:
42+
. 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+
44+
.. Use the `oc get route` command to find the route's host name:
5045
+
5146
[source,terminal]
5247
----
53-
$ curl <pod_ip>:<port>
48+
$ oc get route
5449
----
5550
+
56-
For example:
57-
+
51+
.Example output
5852
[source,terminal]
5953
----
60-
$ curl 172.30.131.89:3306
54+
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
55+
nodejs-ex nodejs-ex-myproject.example.com nodejs-ex 8080-tcp None
6156
----
62-
+
63-
The examples in this section uses a MySQL service, which requires a client
64-
application. If you get a string of characters with the `Got packets out of order`
65-
message, you are connected to the service.
66-
+
67-
If you have a MySQL client, log in with the standard CLI command:
57+
58+
.. Use cURL to check that the host responds to a GET request:
6859
+
6960
[source,terminal]
7061
----
71-
$ mysql -h 172.30.131.89 -u admin -p
62+
$ curl --head nodejs-ex-myproject.example.com
7263
----
7364
+
7465
.Example output
7566
[source,terminal]
7667
----
77-
Enter password:
78-
Welcome to the MariaDB monitor. Commands end with ; or \g.
79-
80-
MySQL [(none)]>
68+
HTTP/1.1 200 OK
69+
...
8170
----
71+
8272
endif::nodeport[]
8373
ifdef::nodeport[]
8474
. To expose a node port for the application, enter the following command. {product-title} automatically selects an available port in the `30000-32767` range.
8575
+
8676
[source,terminal]
8777
----
88-
$ oc expose dc mysql-80-rhel7 --type=NodePort --name=mysql-ingress
78+
$ oc expose dc nodejs-ex --type=NodePort --name=nodejs-ex-ingress
8979
----
9080

9181
. Optional: To confirm the service is available with a node port exposed, enter the following command:
@@ -98,16 +88,16 @@ $ oc get svc -n myproject
9888
.Example output
9989
[source,terminal]
10090
----
101-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
102-
mysql-80-rhel7 ClusterIP 172.30.217.127 <none> 3306/TCP 9m44s
103-
mysql-ingress NodePort 172.30.107.72 <none> 3306:31345/TCP 39s
91+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
92+
nodejs-ex ClusterIP 172.30.217.127 <none> 3306/TCP 9m44s
93+
nodejs-ex-ingress NodePort 172.30.107.72 <none> 3306:31345/TCP 39s
10494
----
10595

10696
. Optional: To remove the service created automatically by the `oc new-app` command, enter the following command:
10797
+
10898
[source,terminal]
10999
----
110-
$ oc delete svc mysql-80-rhel7
100+
$ oc delete svc nodejs-ex
111101
----
112102
endif::nodeport[]
113103

0 commit comments

Comments
 (0)