github.com/helderthh/blue-green-deploy ↗
A simple way to apply a blue-green deployment
Open this visualization on its own page →
Contributors
2
Lines of Code
17
From
2019-08-26
To
2019-08-30
About helderthh/blue-green-deploy
This repository contains a Python3 script that implements blue-green deployment automation for Kubernetes clusters. The `bg-deploy.py` script manages the deployment lifecycle by automatically spinning up a new deployment with the opposite color designation from the currently running one, allowing for zero-downtime updates and easy rollbacks.
The script requires three command-line arguments: the deployment name, an app label for querying the current deployment status, and a deployment version identifier. It automatically detects the color of the existing deployment by reading Kubernetes labels and creates a new deployment with the opposite color, enabling traffic to be switched between versions without service interruption. The configuration relies on specific label structures in the deployment YAML files, particularly the app and deployment labels on both the pod template and service selector.
The repository includes a simple example application built with Flask called ping-pong that demonstrates how to properly structure Kubernetes deployment manifests and labels to work with the blue-green deployment script. This example serves as both a test case and a reference implementation for users wanting to apply the blue-green deployment pattern to their own applications.