<p>Currently, I am running a data-driven web app all in one Docker Image, with nginx, app server, and Postgres, all bundled together. It's just running on a VM with Docker.</p>

<p>I need to migrate this whole stack, all-in-one thing to Kubernetes and looking for a standard recommended cloud-native way of deployment.</p>

<ul>
<li><p>I know I will need to run nginx as separate deployment or pod, and the app server as separate pod/deployment.</p></li>
<li><p>I need to make a choice for the database whether should I use the external database service, running outside Kubernetes, or run my own Postgres on Kubernetes as a stateful set. </p></li>
<li><p>If I use the external service, then I will need to worry when I upgrade the app and make sure there are no version mismatches, and maybe the external service is less flexible as I have no control over that. What would be the recommended way of using the database, either self-deployed over Kubernetes or using the external one?</p></li>
<li><p>About nginx, should I just use my own nginx running as separate deployment or I should use the Ingress Controller? What could be the advantage of using ingress as compared to nginx, though nginx as a deployment can be auto-scaled while the ingress controller can't? </p></li>
</ul>

<p>The whole point of my question here, at each step I want to avoid any anti-pattern of Deploying the stack to Kubernetes so that I don't have to struggle much later.</p>

Ijaz Ahmad
<blockquote>
  <p>If I use the external service, then I will need to worry when I upgrade the app and make sure there are no version mismatches, and maybe the external service is less flexible as I have no control over that. What would be the recommended way of using the database, either self-deployed over Kubernetes or using the external one?</p>
</blockquote>

<p>This is strictly an opinion based on the question. If you are not concerned about costs that much, I would use an external database, possibly a cloud provider database like Amazon RDS or Cloud SQL from GCP. IMO, you would be offloading the database management externally and would be easier to debug in the event something went wrong. Another aspect is that you can take advantage of something with a better performance/scalability like <a href="https://aws.amazon.com/rds/aurora/" rel="nofollow noreferrer">Amazon Aurora</a>.</p>

<p>If you are concerned about costs then go with the in Kubernetes solution which will make you utilize the same set of machines for your database and your nginx, and application pods.</p>

<blockquote>
  <p>About nginx, should I just use my own nginx running as separate deployment or I should use the Ingress Controller? What could be the advantage of using ingress as compared to nginx, though nginx as a deployment can be auto-scaled while the ingress controller can't?</p>
</blockquote>

<p>You can actually autoscale an nginx ingress controller, which runs nginx in the same container and managed by a deployment, you'll have to setup autoscale based on some metric like CPU on the nginx ingress controller pods.</p>
