kubernetes, ingress port redirect issue

8/28/2018

Problem: I have my java application running well in my local, but when i deployed it on the kubernetes with ingress, there is a port forwarding issue..

On my local, following url is working correctly.

http://www.example.com:9080/app/eh
https://www.example.com:9443/app/eh
https://www.example.com/app/eh

On the kubernetes env..

http://www.example2.com/app/eh (working)
https://www.example2.com/app/eh (expected)
https://www.example2.com:80/app/eh (real result)

When I access the https://www.example2.com/app/eh/xxxx page, it takes me to the https://www.example2.com:80/app/eh, rather than https://www.example2.com/app/eh.

kubectl get ing thcaas-eh
NAME        HOSTS   ADDRESS            PORTS     AGE
thcaas-eh   www.example2.com   158.87.63.26,...   80, 443   2d

kubectl describe ing thcaas-eh
Name:             thcaas-eh
Namespace:        thcaas-dev
Address:          158.87.63.26,158.87.63.27
Default backend:  default-http-backend:80 (100.127.50.199:8080)
TLS:
  tls.thcaas.icp1 terminates www.example2.com
Rules:
  Host                                              Path  Backends
  ----                                              ----  --------
  www.example2.com  
                                                    /app/eh   eh:9080 (<none>)
Annotations:
  ssl-redirect:         true
  tls-minimum-version:  1.2
Events:
  Type    Reason  Age               From                      Message
  ----    ------  ----              ----                      -------
  Normal  UPDATE  45m (x8 over 2d)  nginx-ingress-controller  Ingress thcaas-dev/thcaas-eh
  Normal  UPDATE  44m (x8 over 2d)  nginx-ingress-controller  Ingress thcaas-dev/thcaas-eh

How can i make it's working on the port 443? Takes me to the page, https://www.example2.com/app/eh

-- Yinjun Zhang
kubernetes

1 Answer

8/31/2018

Changed to following, works.

from: Rules:
      Host                                              Path  Backends
      ----                                              ----  --------
      www.example2.com  
                                                        /app/eh   eh:9080 (<none>)

to: Rules:
          Host                                              Path  Backends
          ----                                              ----  --------
          www.example2.com  
                                                            /app/eh/   eh:9080 (<none>)
-- Yinjun Zhang
Source: StackOverflow