<p>Install a latest OpenShift CodeReady Container on CentOS VM, and then run a TCP server app written by Java on OpenShift. The TCP Server is listening on port 7777.</p>

<p>Run app and expose it as a service with NodePort, seems that everything runs well. The pod port is 7777, and the service port is 31777.</p>

<pre><code>$ oc get pods -o wide
NAME READY   STATUS    RESTARTS   AGE     IP   NODE         NOMINATED NODE   READINESS GATES
tcpserver-57c9b44748-k9dxg 1/1 Running 0  113m 10.128.0.229  crc-2n9vw-master-0 &lt;none&gt;  &lt;none&gt;

$ oc get svc
NAME               TYPE     CLUSTER-IP      EXTERNAL-IP   PORT(S)                   AGE
tcpserver-ingres  NodePort    172.30.149.98   &lt;none&gt;      7777:31777/TCP            18m
</code></pre>

<p>Then get node IP, the command shows as 192.168.130.11, I can ping this ip on my VM successfully.</p>

<pre><code>$ oc get nodes -o wide
NAME                 STATUS   ROLES           AGE   VERSION             INTERNAL-IP      EXTERNAL-IP   OS-IMAGE                                                   KERNEL-VERSION                CONTAINER-RUNTIME
crc-2n9vw-master-0   Ready    master,worker   26d   v1.14.6+6ac6aa4b0   192.168.130.11   &lt;none&gt;        Red Hat Enterprise Linux CoreOS 42.81.20191119.1 (Ootpa)   4.18.0-147.0.3.el8_1.x86_64   cri-o://1.14.11-0.24.dev.rhaos4.2.gitc41de67.el8
</code></pre>

<p>Now, run a client app which is located in my VM, because I can ping OpenShift Node IP, so I think I can run the client app successfully. The result is that connection time out, my client fails to connect server running on OpenShift.</p>

<p>Please give your advice how to troubleshoot the issue, or any ideas for the issue.</p>

Joe
<p>I understood your problem. As per what you described, I can see your Node port is <code>31777</code>.</p>

<p>The best way to debug this problem is going step by step.</p>

<p>Step 1:
Check if you are able to access your app server using your pod IP and port i.e <code>curl 10.128.0.229:7777/endpoint</code> from one of your nodes within your cluster. This helps you with checking if pod is working or not. Even though <code>kubectl describe pod</code> gives you everything.</p>

<p>Step 2:
After that, on the Node which the pod is deployed i.e <code>192.168.130.11</code> on this try to access your app server using <code>curl localhost:31777/endpoint</code>. If this works, Nodeport is accessible i.e your service is working fine without any issues.</p>

<p>Step 3:
After that, try to connect to your node using <code>curl 192.168.130.11:31777/endpoint</code> from the vm running your client server. Just to let you know, 192. is class A private ip, so I am assuming your client is within the same network and able to talk to 192.169.130.11:31777 Or make sure you open your the respective 31777 port of 192.169.130.11 to the vm ip that has client server.</p>

<p>This is a small process of debugging the issue with service and pod. But the best is to use the ingress and an ingress controller, which will help you to talk to your app server with a url instead of ip address and port numbers. However, even with ingress and ingress controller the best way to debug all the parts are working as expected is following these steps.</p>

<p>Please feel free to let me know for any issues.</p>
