Kustomize Problem Statement idealogy

Source: https://notes.kodekloud.com/docs/CKA-Certification-Course-Certified-Kubernetes-Administrator/Kustomize-Basics-2025-Updates/Kustomize-Problem-Statement-idealogy/page

Summary: This article discusses Kustomize, a tool for managing Kubernetes configurations across multiple environments efficiently.

Key Notes

  • Before diving into what Kustomize is and how to use it, let’s review the problem it addresses and the motivation behind its creation.
  • The Challenge with Multiple Environments
  • Consider a simple example using an nginx deployment YAML file that deploys a single nginx pod:
  • apps/v1
  • Imagine you have multiple environments—a development environment on your local machine, a staging environment, and a production environment. You need your deployment to behave differently in each, with varying numbers of replicas. For example:
  • 1 replica in development,
  • 2–3 replicas in staging, and
  • 5–10 replicas in production.
  • If you use a single nginx deployment YAML file, each environment would deploy only one replica. A common workaround is to create separate directories (dev, stg, prod) and duplicate your configuration file while modifying only the replica count.
  • Example Directory Structure
  • Your directory might be organized as follows:
  • dev:
  • stg:
  • prod:
  • For instance:
  • To deploy the configuration, you would run a command for each environment, for example:
  • $
  • dev/
  • deployment.apps/nginx-deployment
  • For the staging environment:
  • stg/
  • This command creates two nginx pods for staging.
  • The directory structure might end up looking like this:
  • ├── nginx-depl.yml