Configs2026年7月24日·1 分钟阅读

Grafana Tanka — Jsonnet-Based Kubernetes Configuration

Kubernetes configuration management tool that uses Jsonnet for flexible, reusable, and type-safe cluster resource definitions.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Tanka K8s Config
直接安装命令
npx -y tokrepo@latest install cd270c63-86f9-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Grafana Tanka is a Kubernetes configuration tool that uses Jsonnet as its templating language. Developed by Grafana Labs, it replaces static YAML manifests with programmable Jsonnet code and provides a CLI for diffing, applying, and managing environments.

What Tanka Does

  • Generates Kubernetes manifests from Jsonnet source files
  • Manages multiple environments (dev, staging, production) with shared base configurations
  • Shows diffs between the desired state and the live cluster before applying
  • Integrates with jsonnet-bundler (jb) for dependency management of Jsonnet libraries
  • Exports rendered YAML for use with other deployment tools or GitOps pipelines

Architecture Overview

Tanka evaluates Jsonnet files into a JSON object of Kubernetes resources. Each environment has a main.jsonnet entrypoint and spec.json defining the target cluster. Jsonnet code imports libraries like k8s-libsonnet for typed K8s object constructors. Tanka's CLI evaluates Jsonnet, extracts individual objects, then diffs or applies them via the Kubernetes API.

Self-Hosting & Configuration

  • Single binary (tk) with no daemon or server component
  • Each environment is a directory with spec.json (cluster endpoint, namespace) and main.jsonnet
  • Dependencies managed via jsonnet-bundler (jb) with a jsonnetfile.json manifest
  • Supports inline environments for smaller projects without directory structure
  • Connects to clusters using standard kubeconfig files and kubectl context

Key Features

  • Jsonnet eliminates YAML repetition through variables, functions, and object merging
  • Environment abstraction manages per-cluster differences from a shared code base
  • Native diff command compares rendered output against live cluster state
  • Export mode renders all manifests to static YAML files for GitOps workflows
  • Helm chart support allows importing Helm charts as Jsonnet objects

Comparison with Similar Tools

  • Helm — Template-based with Go templating; Tanka uses Jsonnet which is a full data language
  • Kustomize — Overlay-based YAML patching; Tanka offers richer programmability via Jsonnet
  • Pulumi — General-purpose IaC; Tanka is Kubernetes-focused with Jsonnet
  • cdk8s — Generates K8s manifests from TypeScript/Python; Tanka uses Jsonnet with native diffing

FAQ

Q: Do I need to learn Jsonnet to use Tanka? A: Yes. Jsonnet is Tanka's core language. Its syntax is a superset of JSON, so the learning curve is manageable for developers familiar with JSON.

Q: Can Tanka work alongside Helm? A: Yes. Tanka can import Helm charts and render them as Jsonnet objects, allowing you to combine Helm charts with native Jsonnet configuration.

Q: How does Tanka handle multiple clusters? A: Each environment in Tanka points to a specific cluster via spec.json. You create separate environment directories sharing common Jsonnet libraries but targeting different API servers.

Q: Is Tanka used in production? A: Yes. Grafana Labs uses Tanka to manage their production Kubernetes clusters, and the project is actively maintained.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产