Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
Kubernetes

Kubernetes: Use Kustomize to Manage Multiple Environments Without Templates

- 05.06.26 - ErcanOPAK

πŸ“ No Helm. No Templating. Pure YAML.

Helm templates are complex. Kustomize is built into kubectl. Overlay configs for dev, staging, prod. No new syntax to learn.

πŸ“ Folder Structure

k8s/
β”œβ”€β”€ base/
β”‚   β”œβ”€β”€ deployment.yaml
β”‚   β”œβ”€β”€ service.yaml
β”‚   └── kustomization.yaml
└── overlays/
    β”œβ”€β”€ dev/
    β”‚   β”œβ”€β”€ replica_count.yaml
    β”‚   β”œβ”€β”€ configmap.yaml
    β”‚   └── kustomization.yaml
    └── prod/
        β”œβ”€β”€ replica_count.yaml
        β”œβ”€β”€ ingress.yaml
        β”œβ”€β”€ hpa.yaml
        └── kustomization.yaml

πŸ“ Base Kustomization

# base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - deployment.yaml
  - service.yaml

# Common labels for all resources
commonLabels:
  app: myapp
  environment: base

# Add prefix to all resources
namePrefix: myapp-

# Common annotations
commonAnnotations:
  version: "1.0.0"
  built-by: kustomize

βœ… Dev Overlay

# overlays/dev/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - ../../base

# Override replicas
patches:
  - target:
      kind: Deployment
      name: myapp-
    patch: |-
      - op: replace
        path: /spec/replicas
        value: 1

# Add dev-specific config
configMapGenerator:
  - name: app-config
    literals:
      - ENV=development
      - DEBUG=true

# Set namespace
namespace: dev

# Apply command
# kubectl apply -k overlays/dev

πŸ’‘ Kustomize vs Helm

  • Kustomize: No templating, pure YAML, built into kubectl
  • Helm: Template language, requires Tiller (old) or Helm 3
  • Kustomize for simple overlays, Helm for complex packaging
  • Both can work together (Helm chart + Kustomize for patches)

“Helm templates made my head hurt. Kustomize is just YAML overlays. Dev, staging, prod configs are clean, readable, and maintainable. Switched all projects to Kustomize.”

β€” DevOps Engineer

Related posts:

Kubernetes HPA Doesn’t Scale When Traffic Spikes

Kubernetes: Use Kustomize for Environment-Specific Configurations

Kubernetes β€” CPU Limits Cause Throttling Spikes

Post Views: 4

Post navigation

WordPress: Understand the Difference Between Actions and Filters
Docker: Run Containers as Non-Root User for Better Security

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

June 2026
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  
« May    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (953)
  • How to add default value for Entity Framework migrations for DateTime and Bool (882)
  • Get the First and Last Word from a String or Sentence in SQL (838)
  • How to select distinct rows in a datatable in C# (808)
  • How to make theater mode the default for Youtube (805)
  • Add Constraint to SQL Table to ensure email contains @ (580)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (579)
  • Average of all values in a column that are not zero in SQL (538)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (505)
  • Find numbers with more than two decimal places in SQL (454)

Recent Posts

  • C#: Use String Interpolation Instead of Concatenation
  • C#: Use Tuples to Return Multiple Values from Methods
  • SQL: Use ISNULL and NULLIF for Smart NULL Handling
  • .NET Core: Use Data Annotations for Model Validation
  • Git: Use Git Clean to Remove Untracked Files
  • Ajax: Add Custom Headers to Fetch Requests
  • JavaScript: Use console.table to Display Arrays as Tables
  • HTML: Use Spellcheck Attribute to Enable Browser Spell Check
  • CSS: Use user-select to Prevent Text Selection
  • Windows 11: Use Snipping Tool for Instant Screenshots

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (953)
  • How to add default value for Entity Framework migrations for DateTime and Bool (882)
  • Get the First and Last Word from a String or Sentence in SQL (838)
  • How to select distinct rows in a datatable in C# (808)
  • How to make theater mode the default for Youtube (805)

Recent Posts

  • C#: Use String Interpolation Instead of Concatenation
  • C#: Use Tuples to Return Multiple Values from Methods
  • SQL: Use ISNULL and NULLIF for Smart NULL Handling
  • .NET Core: Use Data Annotations for Model Validation
  • Git: Use Git Clean to Remove Untracked Files

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com