Skip to content
This repository has been archived by the owner on Dec 4, 2022. It is now read-only.
Rob Earlam edited this page Aug 6, 2020 · 3 revisions

These instructions are pretty high level, but should help people get up and running in AKS

Creating an AKS Instance

There is a script to create an AKS instance with the required windows node pool, to perform this action you can call

  1. az login
  2. az account set --subscription "<<CHOSEN_SUBSCRIPTION>>"
  3. ./k8s/CreateAKS.ps1 -AzureWindowsPassword "<<CHOSEN_PASSWORD>>" (Note, there are other params you can update to change from the default values - this will take 10-15 mins to complete)

Starting K8s Dashboard

Once the AKS instance is up and running you can start the K8s dashboard pointing to the AKS instance using the following command

az aks browse --resource-group MVP-Site-v2 --name MVP-Site-v2

(If you changed from default values when creating AKS instance this command will need to be changed accordingly.)

Deploying MVP Site to AKS

Choose namespace (staging or prod), create and set context

  • kubectl apply -f .\k8s\specs\namespaces\namespace-staging.yaml
  • kubectl config set-context --current --namespace=mvp-staging or
  • kubectl apply -f .\k8s\specs\namespaces\namespace-prod.yaml
  • kubectl config set-context --current --namespace=mvp-prod

Deploy Private Registry Secrets

Our Images are stored in a private registry so we need to authenticate our AKS instance with that private registry. Details of how this is achieved can be seen here.

Ensure your authentication details are stored in your docker config by following this GitHub issue. - You will need to re-authenticate with the registry after performing this action.

Once all of that is setup, you can run the following command to push your auth to AKS as a secret:

  • kubectl create secret generic regcred --from-file=.dockerconfigjson="<<PATH_TO_DOCKER_CONFIG>>" --type=kubernetes.io/dockerconfigjson

Configuring Helm

You need to setup the Helm ServiceAccount & deploy tiller by running the following commands:

  • kubectl create serviceaccount --namespace kube-system tiller
  • kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
  • helm init --service-account tiller --node-selectors "beta.kubernetes.io/os=linux"
  • kubectl patch deploy --namespace kube-system tiller-deploy -p '{\"spec\":{\"template\":{\"spec\":{\"serviceAccount\":\"tiller\"}}}}'

(You can verify this has been actioned successfully in the K8s Dashboard by changing to the kube-system namespace and ensuring that the tiller-deploy deployment is green)

Deploy Ingress

You can install the NGINX Ingress using the following commands.

  • helm repo add stable https://kubernetes-charts.storage.googleapis.com/
  • kubectl create namespace ingress-basic
  • helm install --name nginx-ingress stable/nginx-ingress --namespace ingress-basic --set controller.replicaCount=2 --set controller.nodeSelector."beta\.kubernetes\.io/os=linux" --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os=linux" --set-string controller.config.proxy-body-size=10m --set controller.service.externalTrafficPolicy=Local

(You can verify this is correct in the K8s dashboard by changing to the ingress-basic namespace and checking that the two deployments (nginx-ingress-controller & nginx-ingress-default-backend) are both green.

Deploy Secrets

The secrets are not included in this repo, extract the secrets from the official k8s specification download and drop them into the /k8s/specs/secrets folder. Ensure they are all populated with the correct values, the run the following command to push all of the secrets into AKS.

kubectl apply -k .\k8s\specs\secrets\

Deploy External Services (Non production only)

Data storage containers (SQL, SOLR, Redis) are only supported in Non-Production. To install these containers run the following command:

kubectl apply -f .\k8s\specs\external\

(Wait for all deployments to show 'green' in the dashboard - this can take a while!)

kubectl apply -f .\k8s\specs\init\

(Wait for all jobs to show 'dark green' in the dashboard - this can take a while!)

Deploy Sitecore application instances

Deploy the Sitecore application instances using the following command.

kubectl apply -f .\k8s\specs\

(Wait for all deployments to show 'green' in the dashboard - this can take a while!)

Serialisation

  • Run dotnet sitecore login --auth <<ID_HOST_URL>> --cm <<CM_URL>> --allow-write true to authenticate your CLI with Id Server
  • Run dotnet sitecore ser push to push the content items to Sitecore
  • Run dotnet sitecore publish to publish the content items