use of nginx.jsonnet in task, and running kapitan in docker

Skip to first unread message

Yoshiaki Nishimura

Mar 10, 2019, 12:18:18 PM3/10/19
to kapitan-discuss
Hi mentors and students,

I have a couple of questions with regards to the use of nginx.jsonnet.

1. In my understanding, jsonnet is used to generate yaml files in kapitan, such as in all the examples from (thanks to Pranav for mentioning): as for all other files such as .md and .sh, we use jinja2 templates because they are not well-formed JSON or YAML.

Since nginx.conf is definitely not JSON or YAML, I'm thinking we should use jinja2 templates. But in that case, what is the use of components/nginx/nginx.jsonnet which is given in the task description?

2. Also, should we generate both nginx.conf or default.conf or both?

Another point is on docker: when I ran

docker run -t --rm -v $(pwd):/src:delegated deepmind/kapitan compile

as recommended in the, which runs just fine and compiles, the compiled folder generated within the container and mapped back to the host machine is owned by root and not the user who ran docker, so every time I need to chown/chmod to see the contents of compiled. Are we expected to create our own container on top of deepmind/kapitan image that creates non-root user in the container prior to running compile, or am I doing something wrong?

I referred to this issue and other sources on this docker problem.

Thank you so much for helping out!


Pawel Sarbinowski

Mar 10, 2019, 1:28:47 PM3/10/19
to Yoshiaki Nishimura, kapitan-discuss
Hi Yoshiaki,

Both very valid questions. :) 

1) You are right about the generation with just jinja2 and jsonnet is not necessary I've updated the task description to avoid future confusion. I had added that as a proposed way based on how most kapitan projects are organized but in this particular case it's not needed.

2) You can generate your_site.conf (and thus put it in /etc/nginx/conf.d ) or you can use nginx.conf and put it under /etc/nginx/. The goal of the task is to use kapitan to generate several templated configs for nginx and accompanying scripts to run the sample configs. Specific implementation details are left to you since they don't directly have to do with actually using kapitan.

For the docker generation you aren't expected to create your own dockerfile image. It's not really easy to generate the compiled/ output with correct permissions from within the container of kapitan as the user namespaces will differ between various hosts and container. It might just be an easier solution to install kapitan through pip and use it that way to compile your project. Use pyenv if you don't want to install kapitan globally. 

Ideally what we'd like to receive from students would be a directory where we can run `kapitan compile` to generate the configs and then just `./compiled/<dev>/` to run a sample nginx container with the sample config. That's all. 
We're interested in seeing that you understand how the inventory works and how kapitan is configured/used.

Hope this helps and let me know if there are other questions,

You received this message because you are subscribed to the Google Groups "kapitan-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit


Pawel Sarbinowski | DevOps Engineer | 

Yoshiaki Nishimura

Mar 10, 2019, 3:16:52 PM3/10/19
to kapitan-discuss
Hi Pawel,

Thank you for such a swift response!

All the points noted, I will use kapitan on the command line to complete this mini project.

Thank you again for the clarification!

Reply all
Reply to author
0 new messages