I would like to run Node-RED as a service on Kubernetes to be able to build a custom API using the HTTP IN nodes. The goal is to be able to push any number of different flows to an arbitrary container running Node-RED using the Node-RED API.
I have tried running Node-RED as a service with 5 replicas and built a flow through the UI that has an HTTP in and HTTP out node. When I try hitting the service using curl on the minikube ip (e.g. curl http://192.168.64.2:30001/test), it will only return the results if the load balancer happens to land on the container that has the flow. Otherwise, it will return an error with HTML.
Any advice on how I should go about solving this issue? Thanks!
This is working as expected. If you are interacting with the Node-RED editor via the load balancer you are only editing the flow on that instance.
If you have 5 instances of Node-RED and only one of them is running a flow with the HTTP endpoints defined then calls to that endpoint will only succeed 1 time in 5.
You need to make sure that all instances have the same endpoints defined in their flows.
There are several ways you can do this, some examples would be: