Deploy services on AKS: Create resources on cluster
April 29, 2019 ยท View on GitHub
Pre-requisites
- AKS created, up & running & kubectl configured to use it.
- Helm installed locally, Tiller installed on cluster
- If using custom images: images built and pushed in a ACR
- If using custom images: docker login secret loaded into the cluster
All tasks must be performed from /Source/Backend/deploy/k8s folder
Deploy Backend Services (Bash terminal)
The script that deploys all services using Helm is deploy.sh. This script needs following parameters:
-r (--registry) <registry-name>: FQDN name of the docker registry to use. In ACR it has the form of<acr-name>.azurecr.io. If not passed Docker Hub is assumed.-c (--clean): If passed all previous helm releases are deleted from cluster.-t (--tag) <tag-name>: Tag of the images to use. Defaults to the name of the current git branch.-o (--org) <org-name>: Docker organization to use. Defaults tosmarthotels.-d (--dns) <dns-name>: DNS of the cluster (if set). Ingress resources will be bound to this dns. If not set, access to cluster is possible using public IP of ingress controller-n (--name) <name>: Name of the deployment. You must use a unique name in evey deployment.--release <release-name>: Name of the helm release. If passed all helm releases contains this value. if not, every helm release has a random name. It is recommended to give this value same value as-n.
The value of -n parameter is used to generate connection strings and similar configuration settings.
Following command cleans the cluster and then deploy backend services from Docker Hub (using latest tag):
./deploy.sh -n edu --release edu -c -t latest
As --release is used all helm releases generated by this deploy will contain the edu value, so you can get them all with a single helm ls | grep edu:

As the value of -n was edu all services and deployments will contain this value:

Deploy Backend Services (Powershell terminal)
The script that deploys all services using Helm is Deploy.ps1. This script needs following parameters:
-registry <registry-name>: FQDN name of the docker registry to use. In ACR it has the form of<acr-name>.azurecr.io. If not passed Docker Hub is assumed.-clean<false>: If passed with true all previous helm releases are deleted from cluster.-imageTag <tag-name>: Tag of the images to use. Defaults to the name of the current git branch. Defaults to false.-dockerOrg <org-name>: Docker organization to use. Defaults tosmarthotels.-dns <dns-name>: DNS of the cluster (if set). Ingress resources will be bound to this dns. If not set, access to cluster is possible using public IP of ingress controller-appName <name>: Name of the deployment. You must use a unique name in evey deployment.-release <release-name>: Name of the helm release. If passed all helm releases contains this value. if not, every helm release has a random name. It is recommended to give this value same value as-appName.
The value of -appName parameter is used to generate connection strings and similar configuration settings.
Following command cleans the cluster and then deploy backend services from Docker Hub (using latest tag):
.\deploy.ps1 -appName edu -release edu -clean $true -imageTag latest
As --release is used all helm releases generated by this deploy will contain the edu value, so you can get them all with a single helm ls | findstr -i edu. As the value of -appName was edu all services and deployments will contain this value.
Deploy a single resource (advanced)
You can redeploy a single resource (API, or PostreSQL or SQL Server) using its helm chart and using helm install directly. This way you can personalize almost everything of the installation.
For your reference here are the parameters passed to helm install by deploy.sh:
--nameto the value specified in--releaseand a suffix for each API. If--releaseis not set, then--nameis set to empty string (generating random release names).--set image.tagto the value of-t--set image.repositoryto the FQDN of the image--set appNameto the value of-nparameter--set ingress.enabledto1(to generate ingress resources)--set ingress.hoststo the value of-dparameter (if any)
Also following ingress annotations are set:
kubernetes.io/ingress.classtoaddon-http-application-routingto use ingress controller provided by AKSingress.kubernetes.io/ssl-redirecttofalseto disallow http to https redirect