首页 > 解决方案 > 有没有办法在 SpringBoot 和 Kubernetes 上运行 react Application?

问题描述

我在 Spring Boot 上运行 React 应用程序,它在 Kubernetes 中作为容器运行。当 React 应用程序通过 REST 与后端交互时,它应该解析 REST URI 的 dns。

我已经尝试直接给出服务名称(即,在从反应应用程序调用 REST API 时,我给出了https://service-name:port/api/v1/test/),但它不起作用。

标签: reactjsspringspring-bootkubernetesmicroservices

解决方案


如果您backend在另一个namespace使用以下格式:

<service-name>.<namespace-name>.svc:port

demo-ser对于命名空间上的 Kubernetes 服务, demoURL 将类似于:

https://demo-ser.demo.svc:8080/

推荐阅读