Repository navigation
Cloud Resource Provisioning
As part of the cloud set-up for the application it has been containerised and will be run using Azure Cloud as previous mentioned. For the app to accessabilbe on the cloud a number of networking resources had to be provisioned these are:
-
Resource Groups Everying we provision on the cloub will need to be a member of a resource group from a billing perspective as they will all be linked to a subscription via the resource group, not only this but as a resoure group can host different kinds of resource together it keeps everything bundled together
-
Virtual Network (Vnet) We set up a Vnet to allow for a more secure and selective approach to traffic manangement as we can decide what aspects of the app will be serviced by what Ip's within the Vnet
-
Subnets Simialrly to Vnets we create a subnet within a Vnet to serve a particualr function in the case of our app we have two subnets set up one for the control plane nodes and another for the worker node and they are segrated from each other due to security and routing reasons
-
Security Groups We have set up a security group which will essential fuction as the firewall and be the barrier between the outside world and our resources within the aks cluster, we set up this firewall using network secruity group rules for the resource group which allows a granular way to control the ingress and egress within the cluster
-
Security Group Rules We have set up two network security group rules for the cluster to control the flow of external traffic and the hosts whioch can access the cluster via ssh
-
Service Principal This is the account used by the terraform files to authenticate and interact with Azure resources, in short it is a service account for terraform. Please note this is defined as part of the AKS cluster along side the node pool
-
Node Pool This will define the number of nodes we wish to have within the cluster and where we can set the conditions for auto-scaling and the max and min number of nodes we wish to have running at any given time. For our app we have chosen the
Standard_DS2_v2vitrual machine as the host for our application with a default starting count of one. it is also woth mentioning that this is defined as part of the AKS cluster along side the service principal -
AKS(Azure Kubernetes Service) Cluster This is the kubernetes cluster we will be defining for opur app to run on and is made up of multiple components as mentioned above, potentially the most important factor to define within this block would be the version of kubernetes we wish to run as different versions will function differently and may not support more advanced features.
In the parent directory for the terrform modular IaC files we have a main.tf as this is in the parent folder it will tie the networking and aks cluster modules together via their outputs and also by providing input paramteres for the variables we have specified in the modules variables.tf files. We will also specify the terraform provider in this main.tf file and in the case of our app as we are using the azure cloud this will in turn mean we are using the Azure provider. We will also specify the service princial credentials that terrafrom will use for our resource provisioning in this section.
- To interact with the cluster we have created using terraform we need to retrieve the kubeconfig file for it which can be done via the following command
az aks get-credentials --resource-group <resource group name> --name <cluster name>