nodePort access applications through Service 4 of OpenShift

In OpenShift usually we are generating Route objects based on a Service to provide access to the application address for external clients. But may not by Route, but directly on the Node to open a nodePort to access the Service (While this is generally not used in production environments). This implementation mechanism of the embodiment below, when a is defined as nodePort Service, OpenShift nodePort open port (below 30,001) in each corresponding Node, such as whether the client access port 30001 that node would have access to the Service (if coupled with a layer of external load balancing can be achieved node access node before the load balancing).
Here Insert Picture Description
Now we realize this configuration on OpenShift.

  1. Create a test application.
$ oc new-project service-nodeport
$ oc new-app openshift/hello-openshift
  1. OpenShift console access, see the Service Configuration hello-openshift of. Found in YAML page "type: ClusterIP" parts to "type: NodePort", then Save. At this time, following the Service Configuration Service will display information, wherein two or less Node Port port is automatically generated. If desired, you can then modify Node Port through the "Edit YAML".
    Here Insert Picture Description
  2. Get either a Worker role of Node node IP address
$ oc get node
NAME                 STATUS   ROLES           AGE   VERSION
crc-2n9vw-master-0   Ready    master,worker   18d   v1.14.6+6ac6aa4b0
$ oc describe node crc-2n9vw-master-0 | grep InternalIP
InternalIP:  192.168.130.11
  1. By Node address + nodePort Service can be accessed.
$ curl 192.168.130.11:32409
Hello OpenShift!
Published 54 original articles · won praise 0 · Views 1166

Guess you like

Origin blog.csdn.net/weixin_43902588/article/details/103496810