kubernetes,入口端口重定向问题

时间:2018-08-28 01:16:02

标签: kubernetes

问题: 我的Java应用程序在本地运行良好,但是当我将它部署到具有入口的kubernetes上时,存在端口转发问题。

在我的本地计算机上,以下网址正常工作。

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

在kubernetes环境中。

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

当我访问https://www.example2.com/app/eh/xxxx页面时,它将带我到https://www.example2.com:80/app/eh,而不是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

如何使它在443端口上工作?带我到页面https://www.example2.com/app/eh

1 个答案:

答案 0 :(得分:0)

更改为以下项目。

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>)