<p>I have created a kubernetes cluster and I successfully deployed my spring boot application + nginx reverse proxy for testing purposes.</p>

<p>Now I'm moving to production, the only difference between test and prod is the connection to the database and the nginx basic auth (of course scaling parameters are also different).</p>

<p>In this case, considering I'm using a cloud provider infrastructure, what are the best practices for kubernetes? 
Should I create a new cluster only for prod? Or I could use the same cluster and use labels to identify test and production machines?</p>

<p>For now having 2 clusters seems a waste to me: the provider assures me that I have the hardware capabilities and I can put different request/limit/replication parameters according to the environment. Also, for now, I just have 2 images to deploy per environment (even though for production I will opt for an horizontal scaling of 2).</p>

<p>I would absolutely 100% set up a separate test cluster.  (...assuming a setup large enough where Kubernetes makes sense; I might consider an easier deployment system for a simple three-tier app like what you're describing.)</p>

<p>At a financial level this shouldn't make much difference to you.  You'll need some amount of hardware to run the test copy of your application, and your organization will be paying for it whether it's in the same cluster or a different cluster.  The additional cost will only be the cost of the management plane, which shouldn't be excessive.</p>

<p>At an operational level, there are all kinds of things that can go wrong during a deployment, and in particular there are cases where one Kubernetes resource can "step on" another.  Deploying to a physically separate cluster helps minimize the risk of accidents in production; you won't accidentally overwrite the prod deployment's ConfigMap holding its database configuration, for example.  If you have some sort of crash reporting or alerting set up, "it came from the test cluster" is a very clear check you can use to not wake up the DevOps team.  It also gives you a place to try out possibly risky configuration changes: if you run your update script once in the test cluster and it passes then you can re-run it in prod, but if the first time you run it is in prod and it fails, that's an outage.</p>

<p>Depending on what you're using for a CI system, the other thing you can set up is fully automated deploys to the test environment.  If a commit passes its own unit tests, you can have the test environment always running current <code>master</code> and run integration tests there.  If and only if those integration tests pass, you can promote to the production environment.</p>
