Failed to connect in Pod - Operation timed out when getting the response from pod

9/6/2018

Download the file https://github.com/openshift/origin/blob/master/examples/hello-openshift/hello-pod.json and execute the following commands:

oc cluster up
oc create -f hello-pod.json
oc get pod hello-openshift -o yaml |grep podIP

it will return the IP address, let say:

podIP: 172.17.0.6

Execute the command:

curl 172.17.0.6:8080

It will return curl: (7) Failed to connect to 172.17.0.6 port 8080: Operation timed out

Info:

oc v3.10.0+dd10d17
kubernetes v1.10.0+b81c8f8
features: Basic-Auth

Server https://127.0.0.1:8443
openshift v3.10.0+e3465d0-44
kubernetes v1.10.0+b81c8f8
-- Diego
kubernetes
openshift
openshift-client-tools

1 Answer

9/6/2018

Your command curl 172.17.0.6:8080 would work from inside a pod.

If you want to connect from your terminal (localhost), you have these ways:

  1. oc port-forward <pod_name> 9999:8080 and in another terminal curl localhost:9999, here the command reference

  2. setup an ingress

The quickest way to debug is option 1.

-- Nicola Ben
Source: StackOverflow