kubernetes,入口端口重定向问题

问题描述 投票:0回答:1

问题:我的java应用程序在我的本地运行良好,但是当我使用入口在kubernetes上部署它时,有一个端口转发问题..

在我的本地,以下网址正常工作。

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

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

当我访问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

kubernetes
1个回答
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>)
© www.soinside.com 2019 - 2024. All rights reserved.