0
votes

Having built a static frontend, my thought was to deploy this to a static assets server like S3, while deploying my microservices backend using kubernetes to a compute service like EC2 or EKS.

However, my research has only turned up one approach: building the frontend as a service in my kubernetes cluster.

My questions:

  1. Is it possible to have two deployment targets like my thought above?
  2. If possible, what are the pros/cons to doing so (in particular, will communication between frontend & backend be tricky?)
  3. Are there any other deployment approaches to consider besides these two?

For additional context, my frontend is a React app built through create-react-app, and I've already extracted by production build. My backend comprises of several NodeJS microservices.

1
That seems like a reasonable enough approach to me; is there a specific issue you're running into?David Maze
I haven’t yet attempted to deploy either, but given the approach seeming reasonable to me, I was surprised that I couldn’t find any resources mentioning of such an approach. All the resources I found described deploying the frontend as a service in the cluster, which led me to two possible conclusions: 1) I’m not searching the proper keywords or 2) the frontend in the cluster approach is preferred.Rahul Nallappa
Webpack will compile the frontend to static files, at which point you can have S3 serve them for you, or run your own plain HTTP server. There's some good reasons to farm it out to S3 if you can (including being able to keep old versions around for clients that haven't reloaded recently enough).David Maze

1 Answers

3
votes

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

Yes, it is possible.

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

In the case of a static frontend, the browser (client) talks to the backend, as long as the user is able to communicate with the backend, everything should be fine.

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

You can deploy your frontend anywhere, you can check out other options like https://www.netlify.com/ and https://vercel.com/

This article should give you a better understanding of Kubernetes with similar architecture https://www.freecodecamp.org/news/learn-kubernetes-in-under-3-hours-a-detailed-guide-to-orchestrating-containers-114ff420e882/