Steps that I followed to deploy Sitecore MVP site to AKS
I have taken the Github Sitecore MVP sample to deploy to AKS. Download/Clone this repository in your local machine.
Before all, lets create these two in Azure. I have done it in West US 2 region.
- Create a Resource Group in Azure
- Create a ACR in same region
Couple of important folders in Sitecore MVP source code:
- Src -> which has the helix based source code of MVP site
- K8s -> all the specs(.yaml) needed for K8s deployment.
- Docker -> contains all the docker build, deploy and data folder
- build - contains all the docker configuration for Sitecore roles
- deploy - act as a deployment volume for the local docker site.
- data - act as a data volume for for the local docker site.
Couple of important files:
- Docker-Compose.yaml - includes all the docker build configuration
- Docker-Compose-Override.yaml - patch file for the Docker-Compose.yaml which is customised for MVP site.
- Init.ps1 - Which sets the environment variables while setting up local instnce
- Up.ps1 - Which starts the local docker instance : same as docker-compose up -d
- K8s/CreateAKS.ps1 - powershell script to create AKS cluster and setup ACR to our AKS
As we now have resourceGroup name and ACR name provide those values in K8s/CreateAKS.ps1 file and run the script. You can do these tasks manually, but script will create one Windows node pool and one Linux node pool which is needed for Sitecore.
What is node pool you ask - https://docs.microsoft.com/en-us/azure/aks/use-multiple-node-pools
We can understand why we need Windows node pool for Sitecore by Why we need Linux node pool? - That's needed for K8s to do its stuff, I am no expert but for Routing etc.
I am 99% sure it won't run successfully on the first attempt. If you are in that 1% please carry on. Else comment out to see if I can help with your error.
Azure Devops CI/CD pipeline creation:
Do all the stuff you need to do, to create a project in Azure Devops and create a pipeline. While creating the pipeline use the file /docker/azure-pipeline.yaml
Update all the variables with your values.
Create two service connections:
- Azure resource manager
If you are doing this for Stage or Prod, we can create a namespace "staging" or "prod" manually in AKS by using the files in K8s/namespaces/namespace-staging.yaml or K8s/namespaces/namespace-prod.yaml
To be continued...