javapadawan javapadawan - 6 months ago 46
JSON Question

Kubernetes: Dynamically create configuration json files from j2 templates

Is there an already built in j2 template processor in kubernetes or docker? I am doing the configuration below and wanted to plugin the values on the template.

Note that using hostPath is not an option since this is using openshift and no pv/pvc can be used.

- image: some-docker-image:latest
name: some-docker-image
- mountPath: /etc/app/conf
name: configuration-volume
. Do some j2 template processing here if possible.

- name: configuration-volume
repository: "https://gitrepo/repo/example.git


There isn't any templating support built into Kubernetes. You can easily build a templating system on top of the yaml/json files that you pass into kubectl -f create though. I know some folks that are using jsonnet to accomplish this.

The discussion around adding templates is happening in if you'd like to contribute.