<p>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.</p>

<p>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 <a href="http://192.168.64.2:30001/test" rel="nofollow noreferrer">http://192.168.64.2:30001/test</a>), 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.</p>

<p>Any advice on how I should go about solving this issue? Thanks!</p>

<p>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.</p>

<p>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.</p>

<p>You need to make sure that all instances have the same endpoints defined in their flows.</p>

<p>There are several ways you can do this, some examples would be:</p>

<ul>
<li>Use the Node-RED Admin API to push the flows to each of the Node-RED instances in turn. You will probably need to do this via the private IP Address of each instance to prevent the load balancer getting in the way.</li>
<li>Use a custom Storage plugin to store the flow in a database and have all the Node-RED instances load the same flow. You would need to restart the instances to force the flow to be reloaded should you change it.</li>
</ul>
