🌟 We are Open Source! Check out our repository on GitHub

Kubernetes Configurations Structure

A scalable and maintainable folder structure for Kubernetes configurations

File Structure

  • k8s
    • base
      • api
        • deployment.yaml
        • service.yaml
        • hpa.yaml
      • frontend
        • deployment.yaml
        • service.yaml
      • database
        • statefulset.yaml
        • service.yaml
        • pvc.yaml
      • shared
        • namespace.yaml
        • configmap.yaml
        • secret.yaml
    • overlays
      • development
        • kustomization.yaml
        • ingress.yaml
        • patches
      • staging
        • kustomization.yaml
        • ingress.yaml
        • patches
      • production
        • kustomization.yaml
        • ingress.yaml
        • patches
  • helm
    • myapp
      • Chart.yaml
      • values.yaml
      • templates
  • monitoring
    • prometheus.yaml
    • grafana.yaml
    • alertmanager.yaml
  • scripts
    • deploy.sh
    • rollback.sh
    • health-check.sh
  • docs
    • deployment.md
    • troubleshooting.md
  • README.md

Directory Structure Explanation

base/api/

API service manifests including deployment, service, and horizontal pod autoscaler.

base/frontend/

Frontend application manifests for web interface deployment.

base/database/

Database manifests including StatefulSet for persistent data storage.

base/shared/

Shared resources like namespaces, ConfigMaps, and Secrets used across services.

hpa.yaml

Horizontal Pod Autoscaler configuration for automatic scaling based on metrics.

statefulset.yaml

StatefulSet configuration for applications requiring persistent storage and stable network identities.

pvc.yaml

Persistent Volume Claim for requesting storage resources from the cluster.

helm/

Helm charts for package management and templating of Kubernetes applications.

helm/myapp/Chart.yaml

Helm chart metadata including version, description, and dependencies.

helm/myapp/values.yaml

Default configuration values for the Helm chart that can be overridden.

monitoring/

Monitoring and observability configurations for Prometheus, Grafana, and alerting.

docs/

Documentation for deployment procedures, troubleshooting, and operational guides.