我正在嘗試使用 Kubernetes 和 Traefik 在本地部署 SpringBoot 應用程序,并使用本地 url。我已經(jīng)檢查了 pod,日志也正常,看來應用程序正在等待我的呼叫。但是當我使用Postman打電話時:GET http://sge-api.local/points/12345/search我得到:502 Bad Gateway這是我的配置:服務:? sge git:(master) ? kubectl get service -n sgeNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEsge-api-local ClusterIP 10.109.84.138 <none> 8888/TCP 75m入口:? sge git:(master) ? kubectl get ingress -n sgeNAME HOSTS ADDRESS PORTS AGEmy-ingress sge-api.local 80 75m我的應用程序在 traefik 儀表板中也顯示正常。我還有其他應用程序也在 .local url 中運行我還設置了一個127.0.0.1/etc/hosts條目sge-api.local這是我的入口:kind: IngressapiVersion: extensions/v1beta1metadata: name: sge-ingress namespace: sge annotations: kubernetes.io/ingress.class: traefikspec: rules: - host: sge-api.local http: paths: - backend: serviceName: sge-api-local servicePort: 8888我的服務:apiVersion: v1kind: Servicemetadata: labels: app: sge-api-local name: sge-api-local namespace: sgespec: ports: - name: "8888" port: 8888 targetPort: 8888 selector: app: sge-api-local我的部署:apiVersion: apps/v1kind: Deploymentmetadata: annotations: reloader.stakater.com/auto: "true" labels: app: sge-api-local name: sge-api-local namespace: sgespec: selector: matchLabels: app: sge-api-local replicas: 1 strategy: type: Recreate template: metadata: labels: app: sge-api-local spec: containers: - image: sge_api:local name: sge-api-local我應該做什么來調(diào)試這個?
1 回答

蝴蝶不菲
TA貢獻1810條經(jīng)驗 獲得超4個贊
你讓 spring 應用程序在監(jiān)聽端口 8081 上運行,這是行不通的。
2019-10-25 14:53:39.002 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (https)
調(diào)整您的服務以使用目標端口 8081 而不是 8888
添加回答
舉報
0/150
提交
取消