Openshift 3.10 Route issue

11/4/2019

I have created simple app in c/c++ and deployed in openshift. App is doing process count . I'm getting proper response using Cluster IP/Port. However when i expose this service i'm always getting 502 Bad Gateway response.

I tried to expose route with/with-out ports label but so far there is no luck

-bash-4.2# oc get pod
NAME                             READY     STATUS    RESTARTS   AGE
temp-app-56bb4d4b4c-49bfw    1/1       Running   0          1d

-bash-4.2# oc get route
NAME                 HOST/PORT                                                         PATH      SERVICES       PORT      TERMINATION   WILDCARD
temp-app-exposed-svc   temp-exposed-svc.router.default.svc.cluster.local             temp-app   1067                    None

-bash-4.2# oc get svc
NAME           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)           AGE
temp-app   ClusterIP   10.x.x.1     <none>        1067/TCP          1d

--- CURL RESPONSE ---
1) Using SVC Cluster IP/PORT

-bash-4.2# curl -kv 10.x.x.1:1067
* About to connect() to 10.x.x.1 port 1067 (#0)
*   Trying 10.x.x.1...
* Connected to 10.x.x.1 (10.x.x.1) port 1067 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 10.x.x.1:1067
> Accept: */*
>
@RAMP: 1.x
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

2) Using Route/DNS Endpoint 
-bash-4.2# curl -kv http://temp-exposed-svc.router.default.svc.cluster.local
* About to connect() to temp-exposed-svc.router.default.svc.cluster.local port 80 (#0)
*   Trying 10.x.x.x...
* Connected to temp-exposed-svc.router.default.svc.cluster.local (10.x.x.x) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: temp-exposed-svc.router.default.svc.cluster.local
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 502 Bad Gateway
< Cache-Control: no-cache
< Connection: close
< Content-Type: text/html
<
<html><body><h1>502 Bad Gateway</h1>
The server returned an invalid or incomplete response.
</body></html>
* Closing connection 0

Ideally exposing service should work but in my case it's not resolving when I do curl with route hostname

-- COD3R
kubernetes
okd
openshift-origin

0 Answers