<p>I have a specific version of postgres with postgis that I need to use for my database. This is what I usually do to provision it:</p>
<ol>
<li>Create a kubernetes secret that holds value of admin password</li>
<li>Create a PV (persistent volume) - I have .yaml for this</li>
<li>Create a PVC(pv claim) to use it for the pgdata - I have .yaml for this</li>
<li>Create deployment - I have .yaml for this</li>
<li>Create a service - I have .yaml for this</li>
</ol>
<p>How do I automate these steps? Eventually I'd like to automate the whole app stack that we use, like a one click install. I can do it with bunch of shell scripts now, but I'm looking for a better way to do this, any good suggestions?</p>

Remember_me
<p>Ever looked into <a href="https://www.terraform.io/" rel="nofollow noreferrer">Terraform</a> or <a href="https://helm.sh/" rel="nofollow noreferrer">Helm</a>? Both are declarative ways to create reproducible deployments. IMO Terraform is more for the basic Kubernetes infrastructure itself, while I see Helm more used for Kubernetes applications running on this infrastructure.</p>
<p>Since you're starting from scratch you could also look at tools like <a href="https://www.pulumi.com/" rel="nofollow noreferrer">Pulumi</a> which allows you to code your infrastructure. This might come handy when doing complex migrations, which would require multiple Terraform/Helm charts and additional scripts exectuted in a certain order, whereas a migration could also be done in one Pulumi exection.</p>
<p>For completeness I am adding <a href="https://github.com/kris-nova/naml" rel="nofollow noreferrer">NAML</a> which is an open source tool I recently came accross.</p>
