如果我有一个 React 前端和一个微服务后端,我可以有两个部署目标(S3 用于前端,EKS 用于后端)吗?

If I have a React frontend and a microservices backend, can I have two deployment targets (S3 for frontend, EKS for backend)?

构建静态前端后,我的想法是将其部署到静态资产服务器(如 S3),同时使用 kubernetes 将我的微服务后端部署到计算服务(如 EC2 或 EKS)。

但是,我的研究只发现了一种方法:building the frontend as a service 在我的 kubernetes 集群中。

我的问题:

  1. 是否可以像我上面的想法一样有两个部署目标?
  2. 如果可能,pros/cons 这样做的目的是什么(特别是前端和后端之间的通信会很棘手吗?)
  3. 除了这两种之外,还有其他部署方法可以考虑吗?

对于其他上下文,我的前端是一个通过 create-react-app 构建的 React 应用程序,我已经通过生产构建提取了它。我的后端由几个 NodeJS 微服务组成。

Is it possible to have two deployment targets like my thought above?

是的,有可能。

If possible, what are the pros/cons to doing so (in particular, will communication between frontend & backend be tricky?)

在静态前端的情况下,浏览器(客户端)与后端对话,只要用户能够与后端通信,就应该没问题。

Are there any other deployment approaches to consider besides these two?

您可以在任何地方部署您的前端,您可以查看其他选项,例如 https://www.netlify.com/ and https://vercel.com/

这篇文章应该可以让您更好地了解具有类似架构的 Kubernetes https://www.freecodecamp.org/news/learn-kubernetes-in-under-3-hours-a-detailed-guide-to-orchestrating-containers-114ff420e882/