<p>I want to implement caching server in a docker container and the whole cluster is orchestrated by kubernetes.</p>

<p>Below is the diagram with the data flow.</p>

<p>Is this setup according to the best practices ? 
If not then please suggest the best way.</p>

<p>Thanks.</p>

<p><a href="https://i.stack.imgur.com/s9PRg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s9PRg.png" alt="enter image description here"></a></p>

AMIT KUMAR
<p>I would recommend:</p>

<ol>
<li><p>Use Kubernetes Operators or StatefulSets with MongoDB instead of stand-alone MongoDB pod. It is extremely dangerous by putting the MongoDB in a pod without any persistence &amp; replica instance. You can find MongoDB operator <a href="https://github.com/operator-framework/awesome-operators" rel="nofollow noreferrer">here</a>.</p></li>
<li><p>Use a separate cache-server in different pods or deployment with master-slave replication for your application. <a href="https://github.com/operator-framework/awesome-operators" rel="nofollow noreferrer">Operators</a> might help you simplify this.</p></li>
<li><p>Attach the Load Balancer with the Ingress Controller. We don't treat database pods as applications pods (unless they shared data with each other via external storage service) since they contains data and Service LoadBalancer can forward request to any pod in the deployment object.</p></li>
</ol>

<p>This varies depending upon needs and requirements.</p>
