- Category
- Developer Tools
- Rank
- No. 3396Tools index
Previous survey · No. 3249 ·
- Pricing
- Open Source
- Type
- TOOL
- Use case
- Deployment & Operations
- Interfaces
- CLI · API
- GitHub
- 4 stars
- Latest release
- 1.0.0
- Date
About
kTailor is a lightweight Kubernetes mutating webhook that injects environment variables, sidecars, init containers, and volumes into Deployments using reusable YAML templates stored in ConfigMaps, leaving the original manifests untouched. It only targets labeled Deployments for near-zero latency and positions itself as a simpler alternative to full policy engines like Kyverno or OPA Gatekeeper.
What it does
A small Go service that sits in the Kubernetes admission path. When a Deployment is created or updated and carries a trigger label naming a template, the service looks that template up in memory, applies its edits to a copy of the Deployment, and sends the API server back a JSON patch describing the difference. The edits cover four jobs: adjusting environment variables and volume mounts on every existing container, adding sidecars, adding init containers, and adding volumes. Templates come either from a shared admin namespace or from the application's own namespace, and admins can switch the second source off.
Why it's ranked here
It does one narrow job with very little code and says plainly where it stops. The whole mutation path is a handful of Go files built on the official Kubernetes client libraries, it is Apache 2.0 licensed, and templates are plain YAML with no policy language to learn. Its own documentation points readers who need conditional logic or other resource types toward Kyverno or OPA Gatekeeper. The limits are real: only Deployments, no Go unit tests in the tree, a Helm chart whose image tag defaults to latest, and a README that says AI tools helped write the code.
What's good
Templates are watched through a Kubernetes informer filtered to one label, so each admission request reads from an in-memory cache instead of calling the API server. System namespaces for Kubernetes itself and OpenShift, plus cattle-system and cert-manager, are refused in code before any user configuration is consulted, as is the service's own namespace. On top of that sits a configurable allowlist or blocklist matched by exact name, prefix or suffix. Every add operation checks for an existing entry with the same name first, so reapplying a template does not stack duplicate sidecars or volumes.
Tradeoffs
Most failures are silent: a missing template, a malformed label or a rejected local template all let the Deployment through unchanged, logged but not surfaced to the user. The Helm default sets the webhook failure policy to Ignore, so an outage behaves the same way. The append operation joins values with a per-entry separator that defaults to empty, while the README describes a colon delimiter, so appending to an existing variable without setting a separator glues the strings together. A template ConfigMap is read from whichever data key comes first, which is unpredictable if the map holds more than one.
How to use it well
Fit it to platform teams that want a few standard injections, such as a proxy variable, a monitoring sidecar or a time-shifting library for tests, applied by label without editing every manifest. Keep each template ConfigMap to a single data key and always set a separator on append entries. Decide early whether application teams may supply their own templates, since a local template can add privileged containers to a workload. Switch the failure policy to Fail once templates are stable if a missed injection matters. Look elsewhere for validation, StatefulSets or DaemonSets, or rules that depend on the object's contents.
Technical notes+
cmd/ktailor/main.go loads /etc/ktailor/ktailor.yaml, builds a SharedInformerFactory with a 30 second resync and a LabelSelector of ktailor.dev/template=true, waits for cache sync, then serves /mutate over TLS or plain HTTP depending on transport.secure. internal/webhook/handler.go returns early unless req.Resource.Resource is deployments, calls filter.IsNamespaceAllowed, splits the ktailor.dev/fit label on the first dot into central or local plus a template name, and loadTemplateFromCache takes the first value from cm.Data by Go map iteration. Unmarshal and patch errors return an AdmissionResponse with Allowed unset, which denies; lookup errors return Allowed true. internal/modifier/modifier.go runs ProcessModifyContainers, ProcessAddContainers, ProcessAddInitContainers and ProcessAddVolumes on a DeepCopy and diffs with mattbaird/jsonpatch; modifyContainers touches Spec.Containers only, not init containers. In internal/modifier/phases.go setOrAppend concatenates with EnvVarAppend.Separator (omitempty in internal/config/config.go), yet the lft-plus222d template in Readme.md appends LD_PRELOAD without setting one. internal/filter/namespace.go hardcodes cert-manager and cattle-system plus kube- and openshift- prefixes, and LoadMainConfig defaults namespaces.mode to blocklist. helm/values.yaml sets failurePolicy Ignore, allowCustomTemplates true, image tag latest and limits of 200m CPU and 256Mi memory. Several code comments are in German.
Observed
- License
- Apache License 2.0 (LICENSE)
- Language
- Go, built on k8s.io client-go, api and apimachinery (go.mod)
- Interface
- Kubernetes mutating admission webhook serving a single mutate endpoint
- Resources mutated
- Deployments only; other resource kinds are allowed through unchanged
- Install surface
- Plain manifests with kubectl, a Makefile build, or the Helm chart in the repository; cert-manager required for TLS
- Default failure policy
- Ignore, set in helm/values.yaml
- Template source
- ConfigMaps labelled ktailor.dev/template, cached in memory by an informer
- Tests
- No Go unit test files in the repository tree; the Helm chart carries only a connection test
- Authorship note
- README states AI tools assisted in writing the code and documentation
Read from Readme.md, go.mod, cmd/ktailor/main.go, internal/webhook/handler.go, internal/modifier/modifier.go, internal/modifier/phases.go, internal/filter/namespace.go, internal/config/config.go, examples/timetravel.yaml, helm/values.yaml, LICENSE.
What it can do
Inject environment variables into Kubernetes Deployments via mutating webhook
ConfigMap-stored YAML template and labeled Deployment → Modified Deployment with injected env vars
Inject sidecar containers into Kubernetes Deployments
ConfigMap-stored YAML template and labeled Deployment → Deployment with injected sidecar container
Inject init containers into Kubernetes Deployments
ConfigMap-stored YAML template and labeled Deployment → Deployment with injected init container
Inject volumes into Kubernetes Deployments
ConfigMap-stored YAML template and labeled Deployment → Deployment with injected volume
Target only labeled Deployments for mutation
Deployment label → Selective webhook mutation
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.