This repository demonstrates a comprehensive GitOps implementation for Kubernetes applications using multiple tools and environments.
This GitOps repository follows a structured approach with clear separation of concerns:
- Applications: Kubernetes application manifests
- Clusters: Environment-specific GitOps tool configurations
- Infrastructure: Cross-cutting infrastructure concerns
ps-implementing-gitops/
├── apps/ # Application manifests
│ ├── base/ # Base application configuration
│ ├── dev/ # Development environment overlays
│ ├── staging/ # Staging environment overlays
│ └── prod/ # Production environment overlays
├── clusters/ # Environment-specific GitOps configurations
│ ├── dev/ # Development cluster (ArgoCD)
│ ├── staging/ # Staging cluster (Terraform)
│ └── prod/ # Production cluster (FluxCD)
└── infrastructure/ # Cross-cutting infrastructure concerns
├── base/ # Base infrastructure configuration
└── overlays/ # Environment-specific infrastructure overlays
├── dev/
├── staging/
└── prod/
- deployment.yaml: Base deployment manifest
- service.yaml: Base service manifest
- kustomization.yaml: Kustomize configuration for base resources
Each environment has its own overlay with environment-specific configurations:
- namespace.yaml: Development namespace definition
- deployment-patch.yaml: Development-specific deployment patches
- kustomization.yaml: Kustomize configuration for dev environment
- namespace.yaml: Staging namespace definition
- deployment-patch.yaml: Staging-specific deployment patches
- kustomization.yaml: Kustomize configuration for staging environment
- namespace.yaml: Production namespace definition
- deployment-patch.yaml: Production-specific deployment patches
- kustomization.yaml: Kustomize configuration for production environment
Uses ArgoCD for GitOps:
- applications/: ArgoCD Application resources
- applicationsets/: ArgoCD ApplicationSet resources for multi-environment management
Uses Terraform for infrastructure management:
- main.tf: Terraform configuration
- variables.tf: Terraform variables
- outputs.tf: Terraform outputs
Uses FluxCD for GitOps:
- flux-system/: FluxCD system components
- kustomization.yaml: FluxCD Kustomization resources
- source.yaml: FluxCD GitRepository sources
- namespaces/: Base namespace definitions
- network-policies/: Base network policy configurations
- rbac/: Base RBAC configurations
- resource-management/: Base resource quotas and limits
- kustomization.yaml: Kustomize configuration for base infrastructure
Each environment has specific infrastructure requirements:
It follows Kustomize patching strategy at the folder level:
- namespaces/: Development namespace patches
- network-policies/: Development network policy patches
- rbac/: Development RBAC patches
- resource-management/: Development resource management patches
It follows Kustomize patching strategy at the folder level:
- namespaces/: Staging namespace patches
- network-policies/: Staging network policy patches
- rbac/: Staging RBAC patches
- resource-management/: Staging resource management patches
It follows Kustomize patching strategy at the root level:
- All the patches are at the root level with a single kustomization.yaml file.
- ArgoCD (Development): Application deployment and sync
- FluxCD (Production): GitOps automation and reconciliation
- Terraform (Staging): Infrastructure as Code for cluster setup
- Kustomize: Configuration management and environment-specific overlays
- Multi-environment support: Separate configurations for dev, staging, and production
- Tool diversity: Demonstrates different GitOps tools for different environments
- Infrastructure as Code: Comprehensive infrastructure management
- Security: RBAC and network policies for each environment
- Resource management: Quotas and limits per environment
- Base and overlay pattern: DRY principle with environment-specific customizations
- Development: ArgoCD monitors the repository and deploys applications to dev cluster
- Staging: Terraform manages infrastructure, applications deployed via GitOps
- Production: FluxCD ensures production deployments follow GitOps principles
This structure provides a complete GitOps implementation showcasing best practices for managing Kubernetes applications across multiple environments with different tooling strategies.