79076966

Date: 2024-10-11 06:05:28
Score: 7.5 🚩
Natty:
Report link

I have similar issue. I am trying to expose the custom-port 27190 . I have even added 27190 in haproxy , but still curl command is failing

Please find my analysis/settings below:

(base) [root@m1305001 ~]# oc get route my-route -n istio-system -o yaml
spec:
  host: my-route-istio-system.apps.ocp-m1305001.lnxero1.boe
  port:
    targetPort: app-port
  to:
    kind: Service
    name: istio-ingressgateway
    weight: 100
  wildcardPolicy: None

(base) [root@m1305001 ~]# oc get svc istio-ingressgateway -n istio-system -o yaml
ports:
  - name: status-port
    port: 15020
    protocol: TCP
    targetPort: 15020
  - name: http2
    port: 80
    protocol: TCP
    targetPort: 8080
  - name: https
    port: 443
    protocol: TCP
    targetPort: 8443
  - name: app-port
    port: 27190
    protocol: TCP
    targetPort: 27190
  selector:
    app: istio-ingressgateway
    istio: ingressgateway
  sessionAffinity: None
  type: ClusterIP

(base) [root@m1305001 ~]# oc get gw bookinfo-gateway -o yaml
spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - '*'
    port:
      name: http
      number: 8080
      protocol: HTTP
  - hosts:
    - '*'
    port:
      name: app-port
      number: 27190
      protocol: HTTP
(base) [root@m1305001 ~]# ~/istioctl pc listeners istio-ingressgateway-5b7d59898f-426bm.istio-system
ADDRESSES PORT  MATCH DESTINATION
0.0.0.0   8080  ALL   Route: http.8080
0.0.0.0   15021 ALL   Inline Route: /healthz/ready*
0.0.0.0   15090 ALL   Inline Route: /stats/prometheus*
0.0.0.0   27190 ALL   Route: http.27190

(base) [root@m1305001 ~]# ~/istioctl pc routes istio-ingressgateway-5b7d59898f-426bm.istio-system
NAME           VHOST NAME     DOMAINS     MATCH                  VIRTUAL SERVICE
http.27190     *:27190        *           /productpage           bookinfo.bookinfo
http.27190     *:27190        *           /static*               bookinfo.bookinfo
http.27190     *:27190        *           /login                 bookinfo.bookinfo
http.27190     *:27190        *           /logout                bookinfo.bookinfo
http.27190     *:27190        *           /api/v1/products*      bookinfo.bookinfo
http.8080      *:8080         *           /productpage           bookinfo.bookinfo
http.8080      *:8080         *           /static*               bookinfo.bookinfo
http.8080      *:8080         *           /login                 bookinfo.bookinfo
http.8080      *:8080         *           /logout                bookinfo.bookinfo
http.8080      *:8080         *           /api/v1/products*      bookinfo.bookinfo
               backend        *           /stats/prometheus*     
               backend        *           /healthz/ready*     

(base) [root@m1305001 ~]# oc get virtualservice bookinfo -o yaml
spec:
  gateways:
  - bookinfo-gateway
  hosts:
  - '*'
  http:
  - match:
    - uri:
        exact: /productpage
    - uri:
        prefix: /static
    - uri:
        exact: /login
    - uri:
        exact: /logout
    - uri:
        prefix: /api/v1/products
    route:
    - destination:
        host: productpage
        port:
          number: 9080

(base) [root@m1305001 ~]# oc get svc productpage -o yaml
spec:
  clusterIP: 172.30.247.193
  clusterIPs:
  - 172.30.247.193
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: http
    port: 9080
    protocol: TCP
    targetPort: 9080
  selector:
    app: productpage
  sessionAffinity: None
  type: ClusterIP

curl commands work only with port 80 & not with 27190

(base) [root@m1305001 ~]# curl -v http://my-route-istio-system.apps.ocp-m1305001.lnxero1.boe:27190/productpage
* Host my-route-istio-system.apps.ocp-m1305001.lnxero1.boe:27190 was resolved.
* IPv6: (none)
* IPv4: 172.23.230.142
*   Trying 172.23.230.142:27190...
* Connected to my-route-istio-system.apps.ocp-m1305001.lnxero1.boe (172.23.230.142) port 27190
> GET /productpage HTTP/1.1
> Host: my-route-istio-system.apps.ocp-m1305001.lnxero1.boe:27190
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
* Empty reply from server
* Closing connection
curl: (52) Empty reply from server

I have added in haproxy

Haproxy 
————————

frontend ocp4-router-http
   mode tcp
   option tcplog
   bind apps.ocp-m1305001.lnxero1.boe:80
   default_backend ocp4-router-http

frontend ocp4-router-http-app
   mode tcp
   option tcplog
   bind apps.ocp-m1305001.lnxero1.boe:27190
   default_backend ocp4-router-http-app

backend ocp4-router-http
   mode tcp
         server worker-0 worker-0.ocp-m1305001.lnxero1.boe:80 check
         server worker-1 worker-1.ocp-m1305001.lnxero1.boe:80 check
   
backend ocp4-router-http-app
   mode tcp
         server worker-0 worker-0.ocp-m1305001.lnxero1.boe:27190 check
         server worker-1 worker-1.ocp-m1305001.lnxero1.boe:27190 check

Can someone guide me here

Reasons:
  • Blacklisted phrase (1): guide me
  • Blacklisted phrase (1): I am trying to
  • Blacklisted phrase (1): I have similar
  • RegEx Blacklisted phrase (2.5): Can someone guide me
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I have similar issue
  • Low reputation (1):
Posted by: Mudassar Rana