<p>I've been using terraform for a while and I really like it. I also set up <a href="https://www.runatlantis.io/" rel="nofollow noreferrer">Atlantis</a> so that my team could have a "GitOps" flow. This is my current process:</p>

<ul>
<li>Add or remove resources from Terraform files</li>
<li>Push changes to GitHub and create a pull request</li>
<li>Atlantis picks up changes and creates a terraform plan</li>
<li>When the PR is approved, Atlantis applies the changes</li>
</ul>

<p>I recently found myself needing to set up a few managed Kubernetes clusters using Amazon EKS. While Terraform is capable of creating most of the basic infrastructure, it falls short when setting up some of the k8s resources (no support for gateways or ingress, no support for alpha/beta features, etc). So instead I've been relying on a manual approach using kubectl:</p>

<ul>
<li>Add the resource to an existing file or create a new file</li>
<li>Add a line to a makefile that runs the appropriate command (kubectl apply or create) on the  new file</li>
<li>If I'm using a helm chart, add a line with <code>helm template</code> and then <code>kubectl apply</code> (I didn't really like using tiller, and helm3 is getting rid of it anyway)</li>
<li>If I want to delete a resource, I do it manually with <code>kubectl delete</code></li>
</ul>

<p>This process feels nowhere near as clean as what we're doing in Terraform. There are several key problems:</p>

<ul>
<li>There's no real dry-run. Using <code>kubectl --dry-run</code> or <code>kubectl diff</code> doesn't really work, it's only a client-side diff. Server-side diff functions are currently in alpha</li>
<li>There's no state file. If I delete stuff from the manifests, I have to remember to also delete it from the cluster manually.</li>
<li>No clear way to achieve gitops. I've looked at <a href="https://github.com/weaveworks/flux" rel="nofollow noreferrer">Weaveworks Flux</a> but that seems to be geared more towards deploying applications.</li>
<li>The makefile is getting more and more complicated. It doesn't feel like this is scaleable.</li>
</ul>

<p>I should acknowledge that I'm fairly new to Kubernetes, so might be overlooking something obvious.</p>

<p>Is there a way for me to achieve a process similar to what I have in Terraform, within the Kubernetes universe?</p>

<p>This is more of an opinion question so I'll answer with an opinion. If you like to manage configuration you can try some of these tools:</p>

<ul>
<li>If you want to use existing YAML files (configurations) and use something at a higher level you can try <a href="https://github.com/kubernetes-sigs/kustomize" rel="nofollow noreferrer">kustomize</a>.</li>
<li>If you want to manage Kubernetes configurations using <a href="https://github.com/google/jsonnet" rel="nofollow noreferrer">Jsonnet</a> you should take a look at <a href="https://ksonnet.io/" rel="nofollow noreferrer">Ksonnet</a>.  Keep in mind that Ksonnet will not be supported in the future.</li>
</ul>

<p>If you want to just automatically do a <code>helm update</code> in an automated way, there is not a tool there yet. You will have to build something at this point to orchestrate everything. For example, we ended up creating an in house tool that does this.</p>
