How sureshdsk/kustomize-k8s-example works
Project type and purpose
• This repository is an “infrastructure‐as‐code” example demonstrating how to structure Kubernetes manifests with Kustomize.
• It is not a full-stack app; rather, it’s an open-source, environment-oriented configuration project.
File structure
Top-level files and directories:
• base/ – contains the canonical Kubernetes resource manifests (ConfigMap, Secret, Deployment, Service) plus a kustomization.yaml that defines the base set.
• overlays/ – contains environment-specific patches (staging, production). Each overlay folder has its own kustomization.yaml and patch files for configmap, secret, deployment.
• LICENSE and readme.md
Pattern:
• “base” is the common layer.
• “overlays” are environment layers that patch or override values in “base.”
• You build the final manifests by running kustomize build overlays/<env> or kubectl apply -k overlays/<env>.
Key points from the README
• Shows how to clone, build, preview, and apply manifests.
• Emphasizes using kustomize as a standalone CLI or as a kubectl plugin.
Main components
a. File configuration layers:
– Base layer folder (base/)
– Overlay layer folders (overlays/staging and overlays/production)
b. Tools & engine:
– Kustomize CLI (or kubectl kustomize)
c. Target system:
– Kubernetes API server / cluster
d. Kubernetes resources produced:
– ConfigMap, Secret, Deployment, Service
Relationships and data flow
1. Developer invokes kustomize build or kubectl apply -k on an overlay.
2. Kustomize engine reads:
– Base kustomization (base/kustomization.yaml)
– Overlay kustomization and patch files
3. It merges/patches the base manifests with the overlay patches.
4. Outputs final YAML resource stream.
5. kubectl sends this stream to the Kubernetes API server.
6. Kubernetes creates or updates the resources in the selected cluster and namespace.
Architectural patterns and principles
• Layered configuration (base + overlays)
• Declarative resource management
• Environment-specific overrides without duplicating the full manifest set
Technologies and frameworks
• Kustomize (native Kubernetes manifest customization)
• kubectl (Kubernetes command-line tool)
• Kubernetes (cluster and API server)
Final advice
• Be very detailed: each file layer, kustomization.yaml, and patch should be represented in an abstracted form.
• Related items, but don’t overcomplicate: the core idea is base + patches → Kustomize engine → Kubernetes.