Search code examples
kubernetesautomation

Automating install steps kubernetes


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:

  1. Create a kubernetes secret that holds value of admin password
  2. Create a PV (persistent volume) - I have .yaml for this
  3. Create a PVC(pv claim) to use it for the pgdata - I have .yaml for this
  4. Create deployment - I have .yaml for this
  5. Create a service - I have .yaml for this

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?


Solution

  • Ever looked into Terraform or Helm? 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.

    Since you're starting from scratch you could also look at tools like Pulumi 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.

    For completeness I am adding NAML which is an open source tool I recently came accross.