Skip to main content

Getting Started with Jsonnet

For some, YAML is quite cumbersome to work with and forces you to duplicate a lot of code in your manifests. If you want a more powerful alternative to YAML, we recommend using Jsonnet.

Template

A template for creating Kubernetes manifests is available in the repo app-template-libsonnet.

Structure

It is good practice to have all your application manifests in a common repository. Here is a recommended directory structure for your Jsonnet files.

team-kubernetes-manifests
├── apps # Put all your k8s applications under /apps
│ ├── myApp1 # 1 folder pr. application
│ │ ├── test # 1 folder pr. environment
│ │ │ ├── app.jsonnet
│ │ │ └── params.json
│ │ ├── dev
│ │ │ ├── app.jsonnet
│ │ │ └── params.json
│ │ ├── common.jsonnet
│ │ └── README.md # In README put the link to source repo
│ ├── myApp2
│ │ ├── test
│ │ │ ├── app.jsonnet
│ │ │ └── params.json
│ │ ├── prod
│ │ │ ├── app.jsonnet
│ │ │ └── params.json
│ │ ├── common.jsonnet
│ │ └── README.md
└───├...

Examples

Production ready Jsonnet examples can be found in these repositories: