This repository showcases a blue-green deployment strategy using Kubernetes, enabling seamless and low-risk application updates by running two separate environments: green (for new releases) and blue (for production).
-
Green Environment (Disaster Recovery)
- Type: DaemonSet
- Manifest:
DR/nginx-green.yaml - Image:
technotuba/nginx:vYYYY.MM - Purpose: Runs the new version on every node for high availability, testing, and backup.
-
Blue Environment (Production)
- Type: StatefulSet
- Manifest:
prod/nginx-blue.yaml - Image:
technotuba/nginx:latest - Purpose: Runs the stable production version with persistent storage and stable network identity.
This structure allows you to test updates thoroughly in the DR environment before promoting them to production, reducing risk and downtime during releases.
-
DaemonSet:
Ensures a pod runs on every node (or a subset), making it ideal for DR scenarios where you want the new version available cluster-wide for testing or failover. -
StatefulSet:
Manages stateful applications with stable identities and persistent storage. Perfect for production workloads that require reliability and data consistency.
-
Deployment/StatefulSet:
Controls the number of pod replicas, suitable for scaling stateless or stateful applications as needed. -
DaemonSet:
Guarantees a pod on every node, best for cluster-wide services or DR testing.
Note:
Manifests for the green (DR) environment are in theDRfolder, while blue (production) manifests are in theprodfolder.
Benefits of this separation:
- Clarity: Instantly see which resources belong to which environment.
- Safety: Reduces the risk of accidental changes to production.
- Simplicity: Makes automation, CI/CD, and manual operations easier and less error-prone.
- Clean Codebase: Keeps your repository organized and maintainable.
Important:
After deploying a new version, remember to update your service to point to the correct environment (green or blue) as needed.
| Workflow | Description | Trigger | Run |
|---|---|---|---|
| Deletes pods in a specified Kubernetes namespace, optionally filtered by label selector. | Manual (workflow_dispatch) |
Run Workflow | |
| Updates the README badge with the current number of blocked Cloudflare IPs. | Scheduled & Manual | Run Workflow | |
| Clears build or deployment caches as needed. | Manual & Push | Run Workflow | |
| Switches deployment traffic to the blue environment. | Manual & Push | Run Workflow | |
| Switches deployment traffic to the green environment. | Manual & Push | Run Workflow | |
| Tags the current green deployment as the latest. | Manual & Push | Run Workflow | |
| Updates or retags images for deployments. | Manual & Push | Run Workflow |

