Deploy Sitecore XP to the Azure Kubernetes Service
This section describes the steps you need to perform to deploy Sitecore Experience Platform to the Azure Kubernetes Service. You must perform the steps in the order they are described here.
Deploy external data services
In production deployments, you must deploy the required external services before you deploy the Sitecore containers in Kubernetes.
The required external services are:
- Microsoft SQL Server or SQL Azure Database Elastic Pool
- Apache Solr (SolrCloud mode)
- RedisLabs Redis
In non-production deployments you can create the external services inside the K8s cluster. For more information, see the section Deploy external services for a non-production deployment.
Create an AKS cluster
To create a new Azure Kubernetes Service (AKS) cluster with a Windows Server node pool, use the Azure command-line interface (Azure CLI) or the Azure portal UI. The AKS cluster must contain one Windows Server 2022 or later node pool with one or more nodes.
For more information about using the Azure CLI to create an AKS cluster, see the Azure AKS documentation.
Configure the Kubectl context cluster
To configure the Kubectl context cluster:
-
Log in to the Azure CLI and set a subscription. For example:
-
Get the credentials for the K8s cluster that were created with the AKS cluster and save them locally. For example:
Deploy an ingress controller
To deploy an ingress controller:
-
Use the Windows AMD64 binaries to Install Helm. You can also use an alternative method as described in Installing Helm Through Package Managers.
-
Add an NGINX ingress controller feed to Helm. For example: helm repo add ingress-nginx
-
Use Helm to deploy the NGINX ingress controller. For example:
NoteIn
./ingress-nginx/ingress.yaml, the nginx.ingress.kubernets.io/proxy-body-size annotation limits payload requests, such as media data upload or Sitecore packages installation, to 512 MB. You can adjust this to fit your installation. For more information about ingress configuration, see NGINX Ingress Controller Configuration. If you need more than 512 MB, you must also adjust themaxRequestLengthsetting in thehttpRuntimenode in the Sitecoreweb.configfile. -
From the root folder of your chosen topology, run this command:
Add grant a 'Contributor' access to your resource group for the Managed Identity
During the deploying Sitecore to the k8s you can face with the issue “failed mount volume“ for “cd, cm“ pods:
Warning: FailedMount 18m (x9 over 28m) kubelet MountVolume.MountDevice failed for volume "pvc-XXXX".The client '{client_id}' with object id '{object_id}' does not have authorization to perform action 'Microsoft.Storage/storageAccounts/listKeys/action' over scope '/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Storage/storageAccounts/{storage_account_id}' or the scope is invalid. If access was recently granted, please refresh your credentials.
To solve this issue, you need to grant a “Contributor“ access to your resource group for the Managed Identity:
-
Get the object id (assignee) using the Managed Identity of the Kubernetes cluster node pool in the resource group scope
$assignee = az aks show -g [resource_group_name] -n [cluster_name] --query identityProfile.kubeletidentity.objectId | ConvertFrom-Json -
Get the node resource group name using the Managed Identity of the Kubernetes cluster node pool in the resource group scope
$nodeResourceGroupName = az aks show -g [resource_group_name] -n [cluster_name] --query nodeResourceGroup | ConvertFrom-Json -
Assign the 'Contributor' role to Kubernetes cluster node pool in the node resource group name for the resource group scope
az role assignment create --assignee-object-id [assignee] --assignee-principal-type “ServicePrincipal“ --role "Contributor" --scope "/subscriptions/[subscription_id]/resourceGroups/[node_resource_group_name]"Where:
[resource_group_name]is your resource group name[cluster_name]is your cluster name[assignee]is your object id for the Managed Identity[subscription_id]is your subscription id[node_resource_group_name]is your node resource group name
Deploy the secrets
To deploy the secrets:
-
Ensure that all the secrets files (.txt, .crt, .key) files in the
/secretsandoverrides\<topology>\secretsfolders are updated according to the requirements listed in The Kubernetes Secrets list. -
From the folder of your chosen topology, run this command:
Deploy external services for a non-production deployment
In production environments you must deploy external services outside the Kubernetes cluster. However, in non-production environments you can deploy the services inside the Kubernetes cluster.
To deploy external services for a non-production deployment:
-
From the folder of your chosen topology, run this command:
-
To check the status of the pods, run this command:
-
To wait until the status of all the pods is Running/OK, run this command:
Deploy the data initialization jobs
To deploy the data initialization jobs:
-
If you use SearchStax as your SolrCloud provider, follow the instructions in Initialize data for SearchStax provider for Solr. If you do not use Searchstax, navigate to the folder of your chosen topology, and run this command:
-
To check the status of the jobs, run this command:
-
To wait until the status of all the jobs is Complete/OK, run this command:
Deploy a persistent volume claim
To deploy a persistent volume claim, run this command:
Deploy the Sitecore pods
To deploy the Sitecore pods:
-
From the folder of your chosen topology, run this command:
-
To check the status of the pods, run this command:
-
To wait until the status of all the pods is Running/OK, run this command:
Update the local host file
To update the local host file:
-
To obtain the external IP address of the ingress controller service for the CM role, run this command:
-
Update the local host file with the external IP address and the hostnames that are required by the ingress controller. The default hostnames are:
cm.globalhostcd.globalhostId.globalhost
Configure the SolrCloud search indexes
When you have finished deploying the containers, you must update all the search indexes.
To configure the SolrCloud search indexes:
- Open a browser and navigate to https://cm.globalhost/sitecore.
- Log in to Sitecore with the admin user and password that you configured as a secret.
- In the Sitecore Control Panel click Populate Managed Schema. In the Schema Populate dialog box, select all the indexes and click Populate.
- In the Sitecore Control Panel, in the Indexing section, click Indexing Manager.
- In the Indexing Manager dialog box, select the indexes you want to rebuild, and then click Rebuild.
- When the search indexes have been rebuilt, click Close.