This weekend's learning activity was figuring out a good way to make k8s templates out of my YAML files. There are a number of ways to do this, including from Ansible or Helm, but after looking at Kustomize, that's the best way for me to go.
Ansible could do it by either:
a) native k8s modules in ansible
b) with YAML files, and the template function, which would just do variable substitution
Helm is extremely overkill for my use case, although I'm sure I could get it to cooperate.
Kustomize is the best mix of $inputFiles + modifications = $outputFiles per environment, and I really like how it works.
You define your top level YAML files and then tell the environments in an overlays/ directory how you want things to change. You can even have it apply a namespace to all resources in there so it's never forgotten or replace values such as ingress hostnames, which have to be unique per env anyways.
This will let me write one set of files and then push the YAML to k8s properly. I also fully intend to use this for a DR kind of situation where I need to recover everything.
All of this will fit very well into my new Gitea instance, replete with an Actions runner.
#homelab #k8s #kubernetes #kustomize #learning #neverstoplearning #technology #yaml #selfhosted
