×

Introduction

In today’s cloud based environments, effective deployment strategies are necessary to achieve zero-downtime deployments and risk mitigation. Blue/Green Deployment is one of the popular deployment strategies which can be combined with tools like Kubernetes, AWS Load Balancer Controller, and Argo Rollouts.

What is a Blue/Green Deployment?

Blue/Green Deployment is a release management strategy that significantly reduces deployment risk. It involves in running two identical environments:

  • Blue: the current production environment
  • Green: the new version/environment

When the new version (Green) is tested and verified, traffic is shifted from Blue to Green. So we can rollback quickly if something goes wrong.

Benefits of Blue/Green Deployments on AWS EKS

  • Blue/Green deployment ensures zero downtime during deployment and quick rollback to the previous version.
  • Seamless Testing is possible in a production-like environment.
  • It assures reduced risk with gradual traffic shifting.
  • Improved CI/CD Pipelines.

Core Components of EKS Blue/Green Deployment

The components of EKS Blue/Green deployments in EKS which are essential for the implementation are:

  • Amazon EKS: Managed Kubernetes service for containerized applications.
  • AWS Load Balancer Controller: Manages AWS Elastic Load Balancers for Kubernetes Ingress.
  • Kubernetes Namespaces or Labels: To separate Blue and Green environments logically.
  • Argo Rollouts: Kubernetes controller for advanced deployment strategies such as Blue/Green and Canary.
  • Ingress Controller or Service Routing: To manage traffic between the Blue and Green environments.

Implementing Blue/Green Deployment in AWS EKS

The steps involved in the implementation of Blue/Green Deployment in AWS EKS are:

  • Step 1: Setup EKS Cluster
  • Step 2: Deploy the Blue Environment
  • Step 3: Configure Load Balancer and Ingress
  • Step 4: Deploy the Green Environment
  • Step 5: Test the Green Environment
  • Step 6: Switch Traffic
  • Step 7: Clean Up

Step 1: Setup EKS Cluster

To set up the EKS cluster, use eksctl, Terraform, or AWS Console.

eksctl create cluster --name blue-green-demo --region us-west-2

Step 2: Deploy the Blue Environment

Create the initial production deployment and expose it via a Kubernetes service.

apiVersion: apps/v1 
kind: Deployment 
metadata: 
   name: app-blue 
spec: 
   replicas: 3 
   template: 
    spec: 
      containers: 
          - name: app 
          image: my-app:blue

Step 3: Configure Load Balancer and Ingress

To route traffic to the Blue environment, use AWS ALB Ingress Controller.

Step 4: Deploy the Green Environment

Create a parallel deployment with the new version.

apiVersion: apps/v1 
kind: Deployment 
metadata: 
  name: app-green 
spec: 
  replicas: 3 
  template: 
    spec: 
       containers: 
           - name: app 
           image: my-app:green

Step 5: Test the Green Environment

Test the green deployment thoroughly before routing traffic.

Step 6: Switch Traffic

To direct traffic to the Green environment, update Ingress rules or the service selector.

selector: 
   app: green

Step 7: Clean Up

When the green version is stable, decommission the blue environment.

Automating Blue/Green Deployments with Argo Rollouts

Argo Rollouts offers advanced features to automate Blue/Green deployments like:

  • Traffic shaping
  • Automated promotions
  • Health checks
  • Analysis templates

To define a rollout:

apiVersion: argoproj.io/v1alpha1 
kind: Rollout 
metadata: 
    name: app-rollout 
spec: 
    strategy: 
        blueGreen: 
             activeService: app-service      
              previewService: app-preview     
              autoPromotionEnabled: false 
    replicas: 3 
    template: 
       spec: 
          containers: 
              - name: app 
              image: my-app:green

Best Practices for Blue/Green Deployments in AWS EKS

The efficient practices involved in deploying blue/green deployment are:

  • Use Feature Flags to enable or disable features without code changes.
  • Monitor Continuously using CloudWatch, Prometheus, or Datadog for observability.
  • Automate with CI/CD by integrating with CodePipeline, ArgoCD, or Jenkins.
  • Limit Exposure using weighted traffic shifting for gradual rollout.
  • Have a Rollback Plan which involves validating rollback steps before deployment.
  • Use IAM roles, security groups, and network policies.
  • Kubernetes readiness and liveness probes are helpful in detecting unhealthy pods.

Conclusion

Finally, Blue/Green deployment is the effective, robust strategy to ensure safe, reliable, and zero-downtime application releases. It provides superior control, visibility, and flexibility during deployments when executed correctly in AWS EKS with tools like Argo Rollouts. To follow the best practices by leveraging EKS-native integrations, learn AWS training in Chennai at Credo Systemz. It helps the teams to build resilient and scalable deployment pipelines which ensure high availability and better customer experiences.

Want to know more about the course curriculum, career counseling, or video references? Just ping us on WhatsApp!

Join Credo Systemz Software Courses in Chennai at Credo Systemz OMR, Credo Systemz Velachery to kick-start or uplift your career path.

Call Now Button