Skip to content

JsonnetKubernetesConfig

Dennis Lee edited this page May 27, 2026 · 1 revision

title: Jsonnet for Kubernetes Config radar_quadrant: Techniques radar_ring: Assess radar_position: center created: 2026-05-22 last_updated: 2026-05-22 related: ["K3sOracleCloud", "TerraformTesting"]

Jsonnet for Kubernetes Config

Jsonnet is a data templating language that generates JSON (a valid subset of YAML), proposed as a replacement for YAML templating engines like Helm in Kubernetes configuration management.

The Problem with YAML Templating

YAML's whitespace sensitivity makes it brittle as a template target. Layering a templating engine (Go templates in Helm, Jinja2) on top compounds the problem: conditionals become convoluted, optional fields require verbose branching, and indentation errors are common. The templating engine has no awareness of YAML structure.

Jsonnet as an Alternative

Jsonnet provides variables, conditionals, functions, and object composition via a + merge operator. Configuration is written as code, not as annotated YAML, and the output is JSON which any Kubernetes tool accepts directly.

Example: optional fields and environment-specific overrides are expressed as clean object merges rather than {{- if .Values.foo }} blocks.

The kr8 tool applies Jsonnet to multi-cluster, multi-environment Kubernetes config management, using Jsonnet as the composition layer above raw manifests.

Trade-offs

Jsonnet requires learning a new language. Helm has far wider ecosystem adoption, more tooling, and a larger chart library. Jsonnet is the better abstraction for teams writing their own configuration; Helm is unavoidable when consuming third-party charts.

Radar Assessment

Jsonnet for Kubernetes Config sits at Techniques → Assess center. The argument against YAML templating is sound and Jsonnet is mature, but applicability is scoped to Kubernetes config management. Center position reflects that a trial is contingent on operating a multi-environment Kubernetes cluster — which is the remaining gate (see k3s on Oracle Cloud Free Tier blip). Without that infrastructure in place, the technique has no immediate application.

Clone this wiki locally