Kubernetes beginner: trigger simple actions between apps

1/20/2022

Very simple question, I have a front-end app running in kubernetes. I would like to create a back-end containerized app that would also be in kubernetes obviously.

User actions in the frontend would need to trigger the execution of a command on the backend (echo success! for example). The UI also needs to know what was the command's output.

What is the best way to implement this in k8s? Either through an internal service, or the two apps can also be in the same pods.

Perhaps there is some kind of messaging involved with applications such as rabbitMQ?

-- gaut
kubernetes

1 Answer

1/20/2022

That depends on your application how you are planning.

Some people host frontend on bucket and from there send HTTP request to backend or so.

You can keep frontend and backend in different PODs or in a single POD also.

For example, if you are using the Node JS with express, you can run as simple API service POD also and keep frontend with it also to serve.

You can use the K8s service name for internal communication instead of adding the Message broker(RabbitMQ, Redis also can be used) unless your web app really needs it.

I would also recommend checking out the : https://learnk8s.io/deploying-nodejs-kubernetes

Github repo of application : https://github.com/learnk8s/knote-js/tree/master/01

Official example : https://kubernetes.io/docs/tutorials/stateless-application/guestbook/

-- Harsh Manvar
Source: StackOverflow