Sitecore now has official support of deployments into kubernetes. This is a guide of what’s involved in deploying Sitecore into kubernetes (Tested with AWS). Download the Sitecore container deployment and extract the relevant (xp / XM) configuration files to a working folder.
Prepare the certificate (.crt) and private key (.key) files for content management, Content Delivery and Identity Server roles and copy them into the relevant folders as per below screenshot.
If you have a multi site implementation you might need to create a separate folder for each domain name under the tls folder and copy the relevant cert and key files and update the Kustomization.yaml
Update the ingress configuration (ingress.yaml) with the domain names to content delivery as per below
Prepare and deploy secrets
- Update the database passwords in secrets folder text files and change the usernames if you have modified the database usernames.
- Generate 64 character keys for telerik encryption, identity secret and reporting api key and update the relevant text files
- Create a x509 certificate for identity server to be used for signing credentials and update the identity certificate and password text files. (sample)
- Update the license text file with base64 encoded string of the license file (sample)
Once the secret files are all prepared, run the following command to push the secrets into kubernetes environment.
kubectl apply -k ./secrets
Deploy external services (optional)
There is a option to use services like SOLR, Redis and SQL in containers for a non-prod environment. It is not recommended/supported to use these in a production environment. To deploy these external services run the following command
kubectl apply -f ./external/
Wait for the new pods to be in Running status. Use
kubectl get pods -o wide -A to check the status of the external pods.
We would need to deploy the initialization jobs to finish setting up the SOLR and SQL pods. The default job configurtaion files provided by sitecore are missing the node selectors, so there is a chance that these jobs end up on linux nodes and fail or get stuck on ContainerCreating status. Add the below snippet just above imagePullSecrets under spec into both solr and mssql init job YAML files (in ./init folder)
nodeSelector: kubernetes.io/os: windows
Run the following command to deploy the init jobs into the cluster.
kubectl apply -f ./init/
Wait for the jobs to return a Completed status, Use the get pods status command used previously.
Deploy Sitecore and Ingress configuration
To deploy sitecore and the nginx ingress configuration run the following command
kubectl apply -f ./ -f ./ingress-nginx/ingress.yaml
Wait for the deployments to be completed and all pods to return either a Running or a Completed status and Sitecore should now be ready.