At Facets, we are committed to optimizing the user experience and ensuring smooth application releases. One particular challenge we encountered was implementing blue-green deployment strategies for applications. While this approach promises seamless updates, we soon realized that it's not all smooth sailing, especially when dealing with secrets and configmaps.

In this blog post, we'll dive deep into the complexities we faced and the solution we found to ensure the safety and stability of our deployments. Join us as we explore the need for versioned secrets/configmaps and how they can save your business from potential disasters.

The Blue-Green Deployment Dilemma

Blue-green deployments are a powerful way to release new versions of applications without downtime. However, when dealing with applications that rely on secrets or configmaps, things can get tricky. Let's illustrate this with an example:

Imagine you have an application, let's call it "Application A," that references "Secret A." Now, you need to update "Secret A" and this change triggers a blue-green deployment for "Application A." This means that during the transition, you have both active and preview pods of "Application A" running simultaneously, some with old data of "Secret A" and others with new data of "Secret A".

representation of blue and green teams deploying software
Blue and green deployments 
The problem here is that without versioning, there's no clear way to distinguish which pods should use the old secret and which should use the new one. To put it simply, if the active pods are restarted, they will get the changes from the updated “Secret A.” This ambiguity can lead to significant issues in the production environment. In the worst case scenario, these complications can even bring your business to a halt.

The Solution: Versioned Secrets and ConfigMaps

To mitigate this issue and ensure a seamless transition during blue-green deployments, we found the solution in versioned secrets and configmaps. By introducing versioning, you create a clear distinction between different iterations of your secrets and configmaps. This  ensures that each pod gets the correct configuration.

Here's how it works:

  1. Versioned  Secrets and ConfigMaps: Start by versioning your secrets and configmaps. For example, instead of updating "Secret A" , create a new version, "Secret A-v1". This way, both old and new pods can reference the appropriate version.
  2. Rollback Safely: In case of any issues during the deployment, rolling back becomes much safer. You can simply switch the pods back to the previous version of the secret/configmap.
  3. Clear Versioning Strategy: Implement a clear versioning strategy to keep track of changes and ensure that secrets/configmaps are updated systematically. This might involve using version numbers, timestamps, or other identifiers that work for your organization’s context.

Conclusion

Blue-green deployments offer significant advantages in terms of minimizing downtime and risk during application updates. However, when dealing with secrets and configmaps, the lack of versioning can introduce confusion and potential disasters.

By adopting Versioned Secrets and ConfigMaps, you can ensure that your pods always have access to the correct configuration, even during the transition phase of a blue-green deployment. This not only enhances the reliability of your deployments, but also provides a safety net for rolling back changes if needed.

At Facets, we learned the importance of versioning the hard way. But now we’re better equipped to handle complex deployments - while maintaining the stability and integrity of our applications. 

Thank you for reading! We hope you found it informative and valuable for your infrastructure management.