πŸ“Kubernetes Project Folder Structure



This content originally appeared on DEV Community and was authored by Shiva Charan

A well-structured Kubernetes project repo usually looks like this:

k8s-project/
β”œβ”€β”€ README.md
β”œβ”€β”€ docs/
β”œβ”€β”€ manifests/
β”‚   β”œβ”€β”€ namespaces/
β”‚   β”œβ”€β”€ deployments/
β”‚   β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ ingresses/
β”‚   β”œβ”€β”€ configmaps/
β”‚   β”œβ”€β”€ secrets/
β”‚   β”œβ”€β”€ storage/
β”‚   └── crds/
β”œβ”€β”€ overlays/
β”‚   β”œβ”€β”€ dev/
β”‚   β”œβ”€β”€ test/
β”‚   └── prod/
β”œβ”€β”€ charts/
β”œβ”€β”€ scripts/
β”œβ”€β”€ ci-cd/
└── templates/

Now let’s break down every folder, its purpose, what goes inside, and why it exists.

📘 1. README.md

Your project documentation.

  • Overview of the application
  • How to deploy
  • Pre-requisites (kubectl, kustomize, helm, cluster roles)
  • CI/CD instructions

📚 2. docs/ – Architecture Documentation

Used for:

  • Architecture diagrams
  • Flowcharts
  • Troubleshooting guides
  • Onboarding docs

Example:

docs/
β”œβ”€β”€ architecture.png
β”œβ”€β”€ sequence-flows.md
└── troubleshooting.md

📦 3. manifests/ – Core Kubernetes YAML Files

This is your main folder containing all the raw Kubernetes manifests.

Typical structure:

manifests/
β”œβ”€β”€ namespaces/
β”‚   └── dev-namespace.yaml
β”‚   └── prod-namespace.yaml
β”œβ”€β”€ deployments/
β”‚   └── app-deployment.yaml
β”‚   └── worker-deployment.yaml
β”œβ”€β”€ services/
β”‚   └── app-service.yaml
β”‚   └── internal-service.yaml
β”œβ”€β”€ ingresses/
β”‚   └── app-ingress.yaml
β”œβ”€β”€ configmaps/
β”‚   └── app-configmap.yaml
β”œβ”€β”€ secrets/
β”‚   └── db-secret.yaml
β”œβ”€β”€ storage/
β”‚   β”œβ”€β”€ pv.yaml
β”‚   └── pvc.yaml
└── crds/
    └── custom-metrics.yaml

Why this folder exists?

To organise all “base” Kubernetes resources cleanly so you don’t mix environments.

🧩 4. overlays/ – Environment-Specific Patches (Kustomize)

This folder is used if you use Kustomize for environment-specific overrides.

overlays/
β”œβ”€β”€ dev/
β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   └── patch-replicas.yaml
β”œβ”€β”€ test/
β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   └── patch-image-tag.yaml
└── prod/
    β”œβ”€β”€ kustomization.yaml
    └── patch-resources.yaml

Purpose:

  • Change CPU/memory only in prod
  • Use latest tag in dev
  • Increase replicas per environment
  • Change configmaps per environment

⛵ 5. charts/ – Helm Chart Folder

If the project is using Helm, you place custom charts here.

charts/
└── myapp/
    β”œβ”€β”€ templates/
    β”œβ”€β”€ values.yaml
    β”œβ”€β”€ values-prod.yaml
    └── Chart.yaml

Use-cases:

  • Template large apps
  • Parameterize configurations
  • Reuse configs across multiple apps

🔧 6. scripts/ – Helper Scripts

Contains Bash/Python scripts for:

  • Deployment automation
  • kubectl wrappers
  • Cleanup scripts
  • Log collectors

Example:

scripts/
β”œβ”€β”€ deploy.sh
β”œβ”€β”€ validate-yamls.sh
└── cleanup.sh

🤖 7. ci-cd/ – Pipeline Definitions

Stores pipeline configuration for:

  • GitHub Actions
  • GitLab CI/CD
  • Azure DevOps
  • Jenkins
  • ArgoCD / FluxCD manifests

Example:

ci-cd/
β”œβ”€β”€ github-actions.yaml
β”œβ”€β”€ gitlab-ci.yaml
└── argo-app.yaml

Purpose:
Automate deployments, validations, and image pushes.

🧱 8. templates/ – YAML Snippets / Boilerplate

Reusable YAML parts, such as:

  • Pod templates
  • Labels/annotations
  • Resource-block templates
  • Common affinity rules

Example:

templates/
β”œβ”€β”€ pod-template.yaml
β”œβ”€β”€ sidecar-template.yaml
└── affinity.yaml

📝 Example Real-World Workflow

A developer wants to deploy a new version to dev:

  1. Updates image version in overlays/dev/kustomization.yaml
  2. Runs
   kubectl apply -k overlays/dev
  1. Kustomize merges: Base manifests (in manifests/) + Dev patches (in overlays/dev/)
  2. Resources get deployed to the cluster.

For Helm:

helm upgrade --install myapp charts/myapp -f charts/myapp/values-dev.yaml

🎯 Summary Table

Folder Purpose
manifests/ Base Kubernetes YAMLs
overlays/ Environment overrides using Kustomize
charts/ Helm charts
scripts/ Deployment helper scripts
ci-cd/ Automation & pipelines
templates/ Reusable YAML snippets
docs/ Documentation & diagrams


This content originally appeared on DEV Community and was authored by Shiva Charan