reactjs - 有没有办法在 SpringBoot 和 Kubernetes 上运行 react Application?
问题描述
我在 Spring Boot 上运行 React 应用程序,它在 Kubernetes 中作为容器运行。当 React 应用程序通过 REST 与后端交互时,它应该解析 REST URI 的 dns。
我已经尝试直接给出服务名称(即,在从反应应用程序调用 REST API 时,我给出了https://service-name:port/api/v1/test/),但它不起作用。
解决方案
如果您backend
在另一个namespace
使用以下格式:
<service-name>.<namespace-name>.svc:port
demo-ser
对于命名空间上的 Kubernetes 服务, demo
URL 将类似于:
https://demo-ser.demo.svc:8080/
推荐阅读
- mysql - Unbale找到wordpress mysql docker,成功连接mysql
- c - 与指针交换时出现分段错误
- css - SVG stroke-dashoffset 动画打破封闭路径
- php - 使用php和sql将数据注入数据库
- javascript - 由 jquery 创建的元素每个不会“接受”点击事件
- python - 在 Python 中使用 shlex 进行词法分析时如何处理多字符评论者?
- javascript - 为什么webpack编译成功但是编译输出中没有我的源代码?
- python - Selenium 在 ubuntu 20.04 上的烧瓶路线内崩溃(chrome 和 firefox)
- visual-studio-code - 如何在 Visual Studio Code 中更改插件的 Intellisense 优先级
- ios - SwiftUI 列表项增加计数