My personal criticism of Helm is the part where it generates Kubernetes resources by composing YAML with text templates. Actually, the template/values pattern of Helm charts is also used in kube-prometheus’s jsonnet, and there’s a need to abstract and manage complex configurations.

I particularly think that Kubernetes resources are not suitable for text templating like HTML. These manifest files represent various APIs supported by Kubernetes and are essentially structured data. And I thought that the most effective tool for processing structured data is a programming language.

Given that Kubernetes is essentially an API, and all operations performed within a Kubernetes cluster (such as creating Pods or monitoring services) ultimately involve interaction with that API. The Kubernetes API server automatically generates and provides complete OpenAPI specifications for all resources and operations.

So with the help of (recently trendy) vibe coding, I wrote kamut in Rust.

The basic structure is simple. By writing deploy.kamut.yaml as follows, you can generate deploy.yaml with the kamut CLI.

deploy.kamut.yaml

kind: Deployment
name: my-app
image: nginx:latest
replicas: 3
env:
  APP_ENV: production
  DEBUG: "false"
resources:
  requests:
    cpu: 100m
    memory: 128Mi
  limits:
    cpu: 200m
    memory: 256Mi

deploy.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app
        image: nginx:latest
        env:
        - name: APP_ENV
          value: production
        - name: DEBUG
          value: "false"
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 200m
            memory: 256Mi

Because it uses definitions for structured data (structs generated based on OpenAPI spec), validation of structural flaws is possible during manifest generation. Actually, generation becomes impossible if there are structural issues.

In Rust, there are also libraries for definitions of resource types in the Kubernetes client API that are automatically generated from the Kubernetes OpenAPI specification.

Since Kamut is a toy project for learning Rust, if you’re interested in this approach and want to try it out, I’d recommend yoke. ;-)