Skip to content

About

A kubernetes operator that dynamically generates and manages app configuration based on kubernetes resources – [✩Star] if you're using it!

Topics

Resources

Stars

92 stars

Watchers

2 watching

Forks

Repository files navigation

Konfigurator Konfigurator

Configuration that follows your cluster. Konfigurator is a Kubernetes operator that renders Go templates against the live Pods, Services and Ingresses in your cluster, writes the result into a ConfigMap or Secret, and mounts it into the workload that needs it. When the cluster changes, the config is re-rendered. Nobody edits a ConfigMap by hand again.

Helm chart Kubernetes Go Slack

The problem

Plenty of software reads a static config file and knows nothing about Kubernetes: nginx OSS or HAProxy outside an ingress controller, Prometheus and Alertmanager static_configs, vendor agents, legacy services. Their config often depends on what is running right now:

  • A proxy needs the current list of backend Services.
  • A scraper or agent needs the pods that carry a certain annotation today.
  • A gateway needs every Ingress host in the namespace.

Helm and Kustomize render at deploy time, so their output is stale the moment a pod is rescheduled. Baking a watcher into every image is a lot of plumbing for a config file. The usual answer is a human with kubectl edit, at 3 a.m.

What Konfigurator does

You write one KonfiguratorTemplate. Konfigurator does the rest.

flowchart LR
  K[Pods · Services · Ingresses<br/>live cluster state] --> T[KonfiguratorTemplate<br/>your Go template]
  T -->|render| C[ConfigMap or Secret<br/>konfigurator-&lt;app&gt;-rendered]
  C -->|mounted by Konfigurator| A[Your Deployment /<br/>DaemonSet / StatefulSet]
  C -.->|optional: Reloader<br/>restarts on change| A
  T -.->|optional| V[Validation webhook<br/>admin allow-listed]
Loading
  1. Render. Your template sees .Pods, .Services and .Ingresses, plus ~40 helper functions (where, groupBy, parseJson, distinctPodsByOwner, …).
  2. Store. The output lands in a ConfigMap or a Secret, your choice.
  3. Mount. Konfigurator adds the volume and the mount to the container you name. No image change, no sidecar.
  4. Repeat. The template is re-rendered on the schedule you set (updateFrequency, default every 2 minutes), so the config tracks the cluster.
  5. Reload. Because the output is a real ConfigMap/Secret, Reloader (reloader.stakater.com/auto: "true") restarts the workload when it changes. Konfigurator renders, Reloader reloads; neither needs to know about the other.

Sixty seconds to a live config

An nginx that needs an upstream per Service in the shop namespace:

apiVersion: konfigurator.stakater.com/v1alpha1
kind: KonfiguratorTemplate
metadata:
  name: edge-upstreams
  namespace: shop
spec:
  renderTarget: ConfigMap          # or Secret
  updateFrequency: 1               # minutes
  app:
    name: edge                     # the Deployment to mount into
    kind: Deployment               # Deployment | DaemonSet | StatefulSet
    volumeMounts:
    - mountPath: /etc/nginx/upstreams
      container: nginx
  templates:
    upstreams.conf: |
      {{- range .Services }}{{ if eq .Namespace "shop" }}
      upstream {{ .Name }} {
        server {{ .Spec.ClusterIP }}:{{ (index .Spec.Ports 0).Port }};
      }
      {{- end }}{{ end }}

Apply it. Within a minute /etc/nginx/upstreams/upstreams.conf exists in the nginx container, lists every Service in shop, and keeps up as Services come and go. Add Reloader and nginx restarts on each change.

The project grew out of per-application log parsing for fluentd, and that walkthrough still shows the mechanics well. For logs today, though, use the Logging operator or the Fluent Operator: they give app teams a CRD and validate and reload the agent config themselves. Konfigurator is for the software that has no such operator. Full comparison.

When to use it, and when not to

Use Konfigurator when… Reach for something else when…
An app reads a config file that depends on other workloads, and has no Kubernetes-native config path The app has native discovery (Prometheus kubernetes_sd, Envoy/xDS, an ingress controller) or a CRD-driven operator (Logging operator, Fluent Operator for logs). Use that; it's event-driven, validated and purpose-built
You can't or won't change the image (vendor software, legacy agents, shared platform tooling) You own the app and can call the API from inside it
Config must be a Kubernetes object (so Reloader, GitOps diffing, RBAC and audit apply) A value known at deploy time is enough: Helm/Kustomize do that better
A few minutes of lag is fine (log parsing rules, dashboards, allow-lists, upstream lists) You need sub-second reaction to pod churn, e.g. a load balancer's live member list. Konfigurator renders on a timer
The inputs are Pods, Services or Ingresses You need other kinds, or data outside the cluster. Write a controller, or ask for the kind as an issue

Compared with the alternatives

Checked against each project in November 2026; details and sources in docs/comparison.md. No maintained general-purpose equivalent exists: kubegen is gone, konfd and kube-template are dormant or archived, kube-gen is alive but writes files inside your image.

Konfigurator kube-gen (in-image) kro (RGD + CEL) shell-operator / Metacontroller Your own controller
Renders from live Pods/Services/Ingresses ✅ ✅ (Pods, Services, Endpoints) ✅ watched collections ✅ ✅
Change to the app image No Yes: binary or sidecar No No No
Output ConfigMap / Secret, auto-mounted file in the container any object via CEL whatever your hook applies whatever you build
You write one CR with a Go template template + reload script RGD + instance, CEL one-liners Bash/Python/jq or a webhook service ~600–1,000 lines of Go
Reload on change Reloader, zero code script Reloader you you
Reaction timer (event-driven: H.5) events + debounce events events events
Maturity since 2018; hardened 2026 v0.5.1, 2025 v1alpha1 mature yours to own

Features

  • Two CRDs. KonfiguratorTemplate is the product. PodMetadataInjector adds annotations to pods as your templates see them, for workloads whose operators won't let you annotate pods directly. It never touches real pods.
  • Go templates with batteries. where, whereExist, groupBy, groupByMulti, parseJson, json, dict, distinctPodsByOwner, coalesce, when, string helpers and more. Full reference.
  • ConfigMap or Secret output, mounted into the container you name on a Deployment, DaemonSet or StatefulSet. Deleting the template unmounts and cleans up.
  • Optional validation webhook. Rendered output is POSTed to a validator you run (a fluentd config checker, a JSON-schema check) before it is applied. Hosts are allow-listed by the cluster admin; calls are bounded (10 s, 64 KiB, no redirects).
  • Safe failure modes. Invalid specs are rejected at admission. Errors that depend on cluster state retry on the next cycle; transient errors back off; nothing is retried forever.
  • Namespaced by default. The chart installs Konfigurator watching its own namespace. Cluster-wide mode is an explicit admin choice (see Security).

Install

helm install konfigurator oci://ghcr.io/stakater/charts/konfigurator \
  --version 0.1.40 \
  --namespace konfigurator --create-namespace \
  --set deployCRD=true

The chart is also published to the classic repo, so existing installs keep working: helm repo add stakater https://stakater.github.io/stakater-charts, then helm install konfigurator stakater/konfigurator …. New installs should use the OCI reference.

deployCRD=true installs the CRDs with the release. Leave it off if you manage CRDs separately (see config/crd/bases). Then create a KonfiguratorTemplate in the same namespace as the workload it configures.

Requirements

  • Kubernetes ≥ 1.30 (OpenShift ≥ 4.17). The chart enforces this via kubeVersion; the reason is CRD validation ratcheting, which lets older invalid templates still be deleted.
  • Upgrading from a release before 0.1.40? Read the upgrade notes first: the validation webhook is now opt-in via an allow-list.

Scope: one namespace or the whole cluster

By default (WATCH_NAMESPACE = the release namespace) templates see only the Pods, Services and Ingresses of their own namespace, and the operator holds only namespaced permissions in practice. To let one Konfigurator serve every namespace, set WATCH_NAMESPACE to "":

env:
- name: WATCH_NAMESPACE
  value: ""

Read this before you do: in cluster-wide mode every template can read every pod spec in the cluster, including environment variables. Only enable it on clusters where all template authors are trusted equally. Per-namespace scoping inside cluster-wide mode is on the roadmap (H.3).

Security model, honestly

  • The operator writes only the objects it creates (konfigurator-<app>-rendered) and the volume/mount on the workload you name.
  • Webhook destinations are chosen by the cluster admin (validationWebhook.allowedHosts), never by the template author, so templates can't be used to probe or exfiltrate.
  • The CRD schema rejects unsupported kinds and targets at admission; the controller cannot be crash-looped by a bad template.
  • Known gaps, tracked publicly in docs/reviews and docs/roadmap.md: cluster-wide mode exposes pod specs across namespaces (H.3); rendered-object names are per app, so two templates for one app collide (H.5).

Status

Konfigurator has run in production since 2018. In November 2026 it went through a full hardening pass: current Go and Kubernetes libraries, admission validation, a bounded webhook, race-free deletes, classified error handling, a kind-based e2e suite and mutation-tested error paths. What's next, and what's deliberately not done yet, is in the roadmap. Changes per version: CHANGELOG.md.

Documentation

Help

Got a question? File a GitHub issue, or talk to us on Slack:

Join Slack Chat

Contributing

PRs are welcome. We follow the fork-and-pull workflow: fork, branch, commit, push, open a PR. Read CLAUDE.md for how changes are planned, tested (make verify) and reviewed here, and docs/releasing.md for how a merge becomes a release.

License

Apache License 2.0 © Stakater

About

Konfigurator is maintained by Stakater. Like it? Tell us at [email protected]. See our other projects, or contact us for professional services and queries.

About

A kubernetes operator that dynamically generates and manages app configuration based on kubernetes resources – [✩Star] if you're using it!

Topics

Resources

Stars

92 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages