With the release of Sitecore 10, we now support running the application inside of Containers and deploying to Kubernetes (K8s). In a previous article, "Sitecore, Docker and Continuous Integration," we went over how to automatically build your images. In this article, we consider the final stages that get executed once the newly built images are available in the Container Registry. Before diving in, however, we want to highlight some important resources for developers. You can download a complete set of K8s specifications from dev.sitecore.com. You will also find a complete installation guide that will take you from a clean instance of K8s to a fully deployed, running instance of Sitecore 10.
If you're new to Kubernetes and not familiar with the concepts of Clusters, Nodes, Pods and the other elements that underpin it, then you will probably want to get up to speed on that before going any further. The Kubernetes site has some great tutorials to introduce you to the key concepts.
Once you're familiar with how to deploy Sitecore to K8s, you can use the same specs as a base to build out and automate your deployment.
Watch the video accompanying this article below, which includes demos of these concepts. Or watch it on Discover Sitecore on YouTube.
Automating a container-based deployment
Automating a container-based deployment is a bit different than a typical deployment. You can see the flow in this diagram of the complete end-to-end process:
As said above, in this article we consider the final stages that get executed once the newly-built images are available in the Container Registry:
Once the images are built, the specs are updated to reference the new image tag and these are pushed to the K8s instance. K8s will then create new pods based on the new container images and will switch the traffic over to those new pods at a controlled rate. You can also control how this switch is made — maybe you want to go for a Blue/Green deployment with a manual switch over, or maybe you want to do a Canary deployment so only some users see the new version. Both of these approaches, along with other deployment approaches, are achievable when working with K8s.
Deploying your content changes
No Sitecore deployment is complete without a content update. Luckily, the new Sitecore CLI released with version 10 makes this a breeze! In just a couple of commands you can authenticate with Identity Server, push your content changes, and finally perform a full publish of the changes.
This can give you the confidence that what is in your source control system is what is running in production, not only from a code perspective, but also including your developer-owned content as well.