Playgrounds Cloud
Kubernetes+

Jsonnet Tanka Playground

Get access to the Jsonnet Tanka playground with one click

Tired of writing verbose Kubernetes configuration files using YAML? Say goodbye to boilerplate code and say hello to Tanka - a configuration utility to help you manage your Kubernetes objects with ease and efficiency.

With our playground, you can dive right into learning and experimenting with Tanka and Jsonnet, without the frustration of complicated software installations. 

What is Tanka?

Tanka is a configuration management tool for Kubernetes clusters. It helps you avoid writing repetitive boilerplate code that is often required when writing configuration files for Kubernetes. 

For example, consider a scenario where you have Kubernetes deployments for development, staging, and production environments, each residing in its own unique namespace. When creating these deployments, you may find yourself writing similar YAML code for each environment. This code often includes a common structure such as the deployment name, labels, selectors, replicas, and image names, which are unchanged between deployments.

With Tanka, you can abstract away this repetitive code into reusable templates and functions. This means that you only have to write the code once and can then easily reuse it for all of your deployments, freeing you from the task of writing the same code over and over again.

To get some idea about how this can help, check out the example from https://github.com/grafana/tanka:

It makes it much easier to declare a deployment. The code is much more compact, requiring fewer lines of text.

It helps us avoid writing all of those standard, but boring and repetitive lines such as:

metadata:
  name: grafana
spec: 
  selector:
    matchLabels:
      name: grafana
template:
  metadata:
    labels:
       name: grafana

Tanka is built around Jsonnet, a data templating language that provides an expressive syntax, using which you can describe the desired state of your Kubernetes cluster in a more natural and intuitive way.

What is Jsonnet?

Jsonnet is a superset of JSON, which is a popular data interchange format. JSON is simple and lightweight but it has limited capabilities. Jsonnet enhances JSON by adding variables, functions, conditionals, and other programming features, making it a more flexible and powerful tool for representing data and configuration. 

So with JSON, we can only declare static data. But with Jsonnet, it's almost like we can write "mini-programs" that can generate some content on the fly. Jsonnet adds to JSON the capability to generate dynamic data where needed.

Playground Features

This playground comes with a single-node Kubernetes cluster, pre-installed with Jsonnet and Tanka. 

Playground Notes

Please note that you can use the playground for 1 hour. If required, you can extend the usage by 15 minutes by clicking on the icon next to the timer icon. 

To learn more about Tanka and related utilities, you can get started with a tutorial by clicking on the link at the top of the command line.