CommunityDevOps ExchangePartners
Articles
9/15/2021
10 minutes

Kubernetes Deployment Strategy Options: Which One to Use And When

Written by
Copado Team
Table of contents

Originally published by New Context.

As the use of containerized applications continues to rise, more organizations are turning to the Kubernetes container management architecture (or K8s) to automate their application scaling and management. One of the reasons Kubernetes has become such a valued tool for container orchestration is because of its automatic state maintenance abilities, which use resource objects known as deployments. There are several Kubernetes deployment strategy options to choose from depending on your particular needs, resources, and infrastructure.

Kubernetes Deployment Strategy Options

In Kubernetes, a deployment is a resource object you use to define the desired end state of your program. The Kubernetes deployment controller will then automatically reach that end state in the most efficient way by comparing the current program state to the desired state and then automatically altering the state to match your end goal. There are six commonly used Kubernetes deployment strategies that we’ll discuss:

Recreate

The recreate Kubernetes deployment strategy involves terminating all running instances of version A and then recreating them with version B. Your application will go down for the length of time it takes to shut down the old instances and start up the new ones. This deployment strategy is typically only used in development environments where downtime won’t affect any production users. The recreate method is best used when you need to run data migrations in between terminating your old code and starting your new code, or when your deployment doesn’t support running version A and version B of your application at the same time.

Ramped

In a ramped deployment, your pods are updated in a rolling fashion, with new instances of your application replacing old instances one at a time. This is the default deployment method for Kubernetes, and is one of the safest and slowest strategies. A ramped deployment uses a readiness probe to make sure a new instance is ready before it deactivates an old instance, and if there is a problem during the deployment, it can be aborted without bringing the whole cluster down. A ramped Kubernetes deployment is recommended for stateful applications and in cases where you need to minimize the performance impact to your end users without paying for additional resources.

Blue/Green

In a blue/green Kubernetes deployment strategy, both your old version (blue) and new version (green) are deployed at the same time, with a Kubernetes service object that acts as a load balancer sending end-user traffic to blue instances and QA and developer traffic to green instances. This allows you to live test the new version of your application without impacting your users. Once your testing is complete, you update the load balancer to send user traffic to the green version of your application. A blue/green deployment strategy works well for avoiding API versioning issues because you’re changing the entire cluster state in one go, but as you need to double your cloud resources to run both versions at the same time, it can be very expensive.

Canary

A canary deployment involves routing a subset of your users to updated instances of your application while the rest continue using the older versions. This type of deployment can be managed with just Kubernetes using ReplicaSet to spin up as many new instances as necessary to get the right percentage of traffic—e.g. If you normally run 100 instances and you want to send 5% of user traffic to version B of your application, you would have five instances running version B and 95 instances running version A. This type of setup can be pretty complicated to manage though, so many organizations employ a load balancer (such as HAProxy) or service mesh (like LInkerd or Istio) to help control traffic. A canary deployment works best when you need real traffic testing of your new versions and have the resources to manage the complex setup.

A/B Testing

As it relates to Kubernetes, A/B testing refers to a type of canary deployment involving distributing traffic to different versions of an application based on specific parameters. Whereas a typical canary deployment will route users based on traffic weight, A/B testing allows you to target specific users based on a cookie, user agent, or another method of identification. One of the primary applications of this Kubernetes deployment is to test the conversion of a feature and then only roll out the version that successfully converts the most users. Like other types of canary deployments, A/B testing deployments are very complex and generally require service meshes to provide fine-grain control over traffic distribution.

Shadow

Shadow is another subset of canary deployments that allows you to test the production load on a new version. A shadow deployment involves releasing version B alongside version A and sending traffic to both at the same time, without the end users noticing any difference. Once the stability and performance of the new version meet your defined requirements, a full rollout is triggered. A shadow deployment works best when your primary concern is the performance load on your production applications, but it is just as complex as other canary deployments, and can be even more expensive because you need to run double the resources.

Comparing Kubernetes Deployment Strategies

Every deployment option comes with its own pros and cons to consider. Here is a breakdown of some of the key strengths and weaknesses of each strateg

Choosing the Right Kubernetes Deployment Strategy Option

Ultimately, when choosing a Kubernetes deployment strategy, you’ll need to analyze your resources, goals, and unique requirements to ensure you make the right decision for your organization. Kubernetes is notoriously difficult to learn, and you need a complete understanding of your applications and cloud container architecture to use it effectively. If your team doesn’t have experience with Kubernetes or other container management solutions, or if your project is too large and complex to handle on your own, you should seek out a development partner to aid in your K8s deployment.

 

 

Book a demo

About The Author

#1 DevOps Platform for Salesforce

We Build Unstoppable Teams By Equipping DevOps Professionals With The Platform, Tools And Training They Need To Make Release Days Obsolete. Work Smarter, Not Longer.

How to Sync Salesforce Environments with Back Promotions
Copado and Wipro Team Up to Transform Salesforce DevOps
DevOps Needs for Operations in China: Salesforce on Alibaba Cloud
What is Salesforce Deployment Automation? How to Use Salesforce Automation Tools
Maximizing Copado's Cooperation with Essential Salesforce Instruments
Future Trends in Salesforce DevOps: What Architects Need to Know
From Chaos to Clarity: Managing Salesforce Environment Merges and Consolidations
Enhancing Customer Service with CopadoGPT Technology
What is Efficient Low Code Deployment?
Copado Launches Test Copilot to Deliver AI-powered Rapid Test Creation
Cloud-Native Testing Automation: A Comprehensive Guide
A Guide to Effective Change Management in Salesforce for DevOps Teams
Building a Scalable Governance Framework for Sustainable Value
Copado Launches Copado Explorer to Simplify and Streamline Testing on Salesforce
Exploring Top Cloud Automation Testing Tools
Master Salesforce DevOps with Copado Robotic Testing
Exploratory Testing vs. Automated Testing: Finding the Right Balance
A Guide to Salesforce Source Control
A Guide to DevOps Branching Strategies
Family Time vs. Mobile App Release Days: Can Test Automation Help Us Have Both?
How to Resolve Salesforce Merge Conflicts: A Guide
Copado Expands Beta Access to CopadoGPT for All Customers, Revolutionizing SaaS DevOps with AI
Is Mobile Test Automation Unnecessarily Hard? A Guide to Simplify Mobile Test Automation
From Silos to Streamlined Development: Tarun’s Tale of DevOps Success
Simplified Scaling: 10 Ways to Grow Your Salesforce Development Practice
What is Salesforce Incident Management?
What Is Automated Salesforce Testing? Choosing the Right Automation Tool for Salesforce
Copado Appoints Seasoned Sales Executive Bob Grewal to Chief Revenue Officer
Business Benefits of DevOps: A Guide
Copado Brings Generative AI to Its DevOps Platform to Improve Software Development for Enterprise SaaS
Celebrating 10 Years of Copado: A Decade of DevOps Evolution and Growth
Copado Celebrates 10 Years of DevOps for Enterprise SaaS Solutions
5 Reasons Why Copado = Less Divorces for Developers
What is DevOps? Build a Successful DevOps Ecosystem with Copado’s Best Practices
Scaling App Development While Meeting Security Standards
5 Data Deploy Features You Don’t Want to Miss
Top 5 Reasons I Choose Copado for Salesforce Development
How to Elevate Customer Experiences with Automated Testing
Getting Started With Value Stream Maps
Copado and nCino Partner to Provide Proven DevOps Tools for Financial Institutions
Unlocking Success with Copado: Mission-Critical Tools for Developers
How Automated Testing Enables DevOps Efficiency
How to Keep Salesforce Sandboxes in Sync
How to Switch from Manual to Automated Testing with Robotic Testing
Best Practices to Prevent Merge Conflicts with Copado 1 Platform
Software Bugs: The Three Causes of Programming Errors
How Does Copado Solve Release Readiness Roadblocks?
Why I Choose Copado Robotic Testing for my Test Automation
How to schedule a Function and Job Template in DevOps: A Step-by-Step Guide
Delivering Quality nCino Experiences with Automated Deployments and Testing
Best Practices Matter for Accelerated Salesforce Release Management
Maximize Your Code Quality, Security and performance with Copado Salesforce Code Analyzer
Upgrade Your Test Automation Game: The Benefits of Switching from Selenium to a More Advanced Platform
Three Takeaways From Copa Community Day
Cloud Native Applications: 5 Characteristics to Look for in the Right Tools
Using Salesforce nCino Architecture for Best Testing Results
How To Develop A Salesforce Testing Strategy For Your Enterprise
What Is Multi Cloud: Key Use Cases and Benefits for Enterprise Settings
5 Steps to Building a Salesforce Center of Excellence for Government Agencies
Salesforce UI testing: Benefits to Staying on Top of Updates
Benefits of UI Test Automation and Why You Should Care
Types of Salesforce Testing and When To Use Them
Copado + DataColada: Enabling CI/CD for Developers Across APAC
What is Salesforce API Testing and It Why Should Be Automated
Machine Learning Models: Adapting Data Patterns With Copado For AI Test Automation
Automated Testing Benefits: The Case For As Little Manual Testing As Possible
Beyond Selenium: Low Code Testing To Maximize Speed and Quality
UI Testing Best Practices: From Implementation to Automation
How Agile Test Automation Helps You Develop Better and Faster
Salesforce Test Cases: Knowing When to Test
DevOps Quality Assurance: Major Pitfalls and Challenges
11 Characteristics of Advanced Persistent Threats (APTs) That Set Them Apart
7 Key Compliance Regulations Relating to Data Storage
7 Ways Digital Transformation Consulting Revolutionizes Your Business
6 Top Cloud Security Trends
API Management Best Practices
Applying a Zero Trust Infrastructure in Kubernetes
Building a Data Pipeline Architecture Based on Best Practices Brings the Biggest Rewards
CI/CD Methodology vs. CI/CD Mentality: How to Meet Your Workflow Goals
DevOps to DevSecOps: How to Build Security into the Development Lifecycle
DevSecOps vs Agile: It’s Not Either/Or
How to Create a Digital Transformation Roadmap to Success
Infrastructure As Code: Overcome the Barriers to Effective Network Automation
Leveraging Compliance Automation Tools to Mitigate Risk
Moving Forward with These CI/CD Best Practices
Top 3 Data Compliance Challenges of Tomorrow and the Solutions You Need Today