So you’ve decided to integrate Kubernetes into your deployment pipeline. Good for you! You’re updating your continuous delivery pipeline with one of the most flexible tools for deploying and orchestrating microservices.
But simply dropping Kubernetes into your deployment pipeline or switching from a legacy deployment technology to containers won’t necessarily deliver big benefits. If you want to take full advantage of Kubernetes as part of an automated release pipeline, you need to make sure that you are taking steps to get the most out of Kubernetes that you can.
Toward that end, let’s explore some top strategies for leveraging Kubernetes within a container deployment pipeline.
Use Microservices with Kubernetes
You may or may not have been deploying your application using microservices prior to adopting Kubernetes. And if you were already using microservices, you may or may not have broken your app down into the ideal number of microservices for striking the right balance between agility and manageability.
Kubernetes was designed first and foremost as a tool for managing microservices-based applications. To get the most out of its load balancing and availability features, you should be deploying your application using microservices. While it may not be practical to migrate an entire app to microservices overnight, you should at least put a plan in place for switching to microservices if you want to leverage all of Kubernetes’ features.
Automate, Automate, Automate
If you have a CI/CD pipeline in place, you probably already automate many of your software delivery processes, whether or not you use Kubernetes.
That said, one of the chief selling points of Kubernetes is that it allows you to automate even more—especially when it comes to orchestrating applications within production.
But to use Kubernetes to the greatest effect, you need to make sure that you take full advantage of its automation features. This doesn’t happen naturally. If you have added Kubernetes to a pre-existing CI/CD pipeline, you may not previously have been automating management of your production environment, and you may not have integrated your various monitoring tools to work together.
To reap the full benefits of Kubernetes, you want to make sure you are doing these things. Take your hands off of production management processes as much as possible, and let Kubernetes handle them for you on the basis of preconfigured policies.
Security Considerations for Kubernetes
Whenever you add a new tool to your deployment stack, you also create new potential security vulnerabilities that you need to manage. Kubernetes is no exception.
A detailed overview of best practices for securing Kubernetes is beyond the scope of this post, but I’d recommend starting by following the advice offered by the Kubernetes project itself.
Kubernetes Canary Deployment
You can add more flexibility and reliability to your continuous delivery process by taking advantage of Kubernetes’ ability to support canary deployments. While you don’t need Kubernetes to do canary deployments (there are other possible approaches), Kubernetes makes it easier to do canary deployments by deploying to some pods before others.
Automated Rollbacks in Kubernetes
Another handy trick that Kubernetes simplifies is the ability to perform automated rollbacks of a deployment in the event that something goes wrong. Automated rollbacks help to minimize service disruptions and reduce manual management requirements. For details on setting up automated rollbacks, refer to the Kubernetes documentation.
Kubernetes is a great tool for improving CI/CD pipelines and creating your own container deployment pipeline. In fact, it’s arguably an essential tool if you want to build a lean, efficient, fully automated release pipeline today.
However, Kubernetes doesn’t perform magic. Its ability to deliver significant benefits depends on taking the proper configuration steps, as described above.