kubernetes - kubernetes,入口端口重定向问题
问题描述
问题:我的 java 应用程序在本地运行良好,但是当我将它部署在具有入口的 kubernetes 上时,出现端口转发问题..
在我的本地,以下 url 工作正常。
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
解决方案
更改为以下,有效。
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>)
推荐阅读
- python - 通过 python 库使用来自私有注册表的图像创建 docker 服务
- reactjs - 如何从我的 react 应用程序访问 Electron 的进程对象?
- pyspark - 将json文件保存到数据框时如何删除空值
- c# - C# Parallel Array,我不明白为什么 zipFound 是 bool zipFound = false; 任何人都可以向我解释谢谢:)
- java - 在使用 jooq 与 hstore 合并的重复键上
- laravel - 在 laravel 中访问表数据透视表
- faunadb - 如何从动物数据库中的文档中删除特定元素?
- linux - 如何在linux bash中删除除最后5个按日期排序的所有文件
- javascript - 如何在 Youtube 中获取授权令牌?
- html - 角度 1.5