There really isn't any need to templatize kubernetes. They have auto-generated client libraries for most popular languages which let you define configurations as code, and serialize to json/yaml of that's what you want.

Can you give some examples? I don't understand what you mean by autogenerated client libraries, unless you mean the python and go clients. Those aren't for kubernetes yamls, though.

The python one is a good example: https://github.com/kubernetes-client/python

This is auto generated from a swagger API spec. Of course the intent is that you define your service and launch it with the client, but if you want a yaml file you can dump the objects to yaml - it would be far better than templating.