Kustomize — Template-Free Kubernetes Manifest Customization
Kustomize lets you customize Kubernetes manifests through overlays and patches without templates. Maintained by SIG CLI and built into kubectl, it is the declarative way to manage environment-specific YAML across dev/staging/prod.
Installation agent prête
Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.
npx -y tokrepo@latest install 643d48eb-37c8-11f1-9bc6-00163e2b0d79 --target codexÀ exécuter après confirmation du plan en dry-run.
What it is
Kustomize lets you customize Kubernetes manifests through overlays and patches without using templates. Maintained by SIG CLI and built into kubectl since version 1.14, it provides a declarative way to manage environment-specific YAML across dev, staging, and production. You keep a base set of manifests and layer environment-specific modifications on top.
Kustomize targets platform engineers, SREs, and DevOps teams who manage Kubernetes deployments across multiple environments and want to avoid the complexity of Helm's templating language.
How it saves time or tokens
Kustomize eliminates template syntax from your Kubernetes manifests. Your base YAML is valid Kubernetes YAML at all times, making it readable and testable without rendering. Overlays compose cleanly: you add patches, change image tags, or modify resource limits per environment without duplicating entire manifests. Since it is built into kubectl, there is no extra binary to install or maintain.
How to use
- Create a base directory with your Kubernetes manifests:
# base/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-server
spec:
replicas: 1
template:
spec:
containers:
- name: api
image: myapp:latest
resources:
limits:
memory: 256Mi
- Create a kustomization.yaml for the base:
# base/kustomization.yaml
resources:
- deployment.yaml
- service.yaml
- Create an overlay for production:
# overlays/production/kustomization.yaml
resources:
- ../../base
patches:
- patch: |-
- op: replace
path: /spec/replicas
value: 3
target:
kind: Deployment
name: api-server
images:
- name: myapp
newTag: v2.1.0
- Apply with kubectl:
kubectl apply -k ./overlays/production
Example
Preview the rendered output before applying:
kubectl kustomize ./overlays/production
# or standalone
kustomize build ./overlays/production
Related on TokRepo
- DevOps tools — infrastructure and deployment automation resources
- Featured workflows — curated developer resources across categories
Common pitfalls
- Deeply nested overlay structures become hard to reason about. Keep the overlay hierarchy to two levels (base + environment) for maintainability.
- Strategic merge patches silently ignore unknown fields. Validate your patches against the actual resource schema to catch errors early.
- Forgetting to list resources in kustomization.yaml means they are silently excluded from the build output.
Questions fréquentes
Helm uses Go templates to generate Kubernetes YAML, requiring a templating language and a values file. Kustomize uses plain YAML with overlays and patches. Kustomize is simpler for environment-specific customization; Helm is more powerful for packaging and distributing charts.
Yes. Since kubectl 1.14, you can use kubectl apply -k and kubectl kustomize natively without installing a separate binary. The standalone kustomize binary offers newer features that may not be in your kubectl version.
Yes. You can use Kustomize's helmCharts field to render Helm charts as part of a Kustomize build. This lets you apply Kustomize patches on top of Helm-rendered output.
Yes. Kustomize can generate ConfigMaps and Secrets from files or literals using configMapGenerator and secretGenerator. It appends content hashes to names for automatic rollout on changes.
Create separate overlay directories for each environment (dev, staging, production). Each overlay references the same base and applies environment-specific patches. Use kubectl apply -k ./overlays/production to deploy.
Sources citées (3)
- Kustomize GitHub— Kustomize is maintained by SIG CLI and built into kubectl
- Kubernetes Documentation— Overlay-based customization without templates
- Kustomize Reference— ConfigMap and Secret generation with content hashes
En lien sur TokRepo
Fil de discussion
Actifs similaires
Freelens — Open Source Kubernetes IDE and Dashboard
Freelens is a free and open-source Kubernetes IDE forked from the original Lens Desktop. It provides a graphical interface for managing clusters, viewing workloads, inspecting logs, and debugging pods without memorizing kubectl commands.
Gentelella — Free Bootstrap Admin Dashboard Template
A free Bootstrap-based admin dashboard template with a clean design, multiple page layouts, and pre-integrated charting and table plugins for building back-office interfaces.
Kdenlive — Free Open Source Video Editor by KDE
Kdenlive is a free, open-source non-linear video editor built on the MLT framework and Qt. Developed by KDE, it provides multi-track editing, a rich effects library, proxy clip support, and titling tools for video production on Linux, Windows, and macOS.
Shotcut — Free Cross-Platform Video Editor
Shotcut is a free, open-source video editor that supports hundreds of audio and video formats via FFmpeg. Built on the MLT multimedia framework, it offers a timeline editor, filters, transitions, and hardware-accelerated encoding on Windows, macOS, and Linux.