DIGIT Docs
v2.3
  • DIGIT Knowledge Base
  • Local Governance
v2.3
  • Introducing Public Finance Management (iFIX)
    • Strategy & Approach
  • Platform
    • Release Notes
      • iFIX Core Release Notes
        • iFIX Core Build Updates
      • iFIX Adaptor Release Notes
        • iFIX Adaptor Build Updates
      • Migration to DIGIT Architecture
        • Migration Checklist
        • Migration Steps - iFIX
        • Migration Steps - Adapter
    • Specification
      • Functional Specifications
      • Technical Specification
        • Information Model
        • APIs
    • Architecture
      • Technology
    • Services
    • Roadmap
    • Source Code
    • Setup
      • iFIX Service Setup
      • Infrastructure Setup
        • Quickstart/Local Setup
        • On AWS
        • On Azure
      • Deploy Services
        • Deploy from your local machine
        • CI/CD
      • API Access Key
    • Configuration
      • Core Service Documents
        • Master Data Setup
          • Domain Services
            • iFIX Core Master Data Service
            • iFIX Core Fiscal Event Service
            • iFIX Core Fiscal Event Post-Processor
        • iFIX Core Data Cleanup
        • iFix Department Entity Service
        • iFix Client Management Service
          • Keycloak Setup
      • Configuring Master Data
      • Promotion Docs
        • Master Data Service Promotion Doc
        • mGramSeva iFIX Adapter
        • Department Entity Service Promotion
        • Fiscal Event And Fiscal Event Post-processor Service Promotion
        • MongoDB Migration
  • Products
    • mGramSeva
      • Functionalities
        • Login and Forgot Password
        • User Roles and Home Screen
        • Create Consumer
        • Search Consumer
        • Edit Consumer
        • View Consumer
        • Billing - Bulk Demand Generation
        • Billing - Metered Connection
        • Revenue Collection - Offline
        • Expenditure - Add Expense
        • Expenditure - Modify Expense
        • User Onboarding - Bulk Upload
        • User Onboarding/Walkthrough
        • Feedback - Post Payment
        • SMS Notifications
        • Home Page Notifications
        • Edit User Profile
        • Bill and Receipt PDF
        • Update Expense Search
        • Bulk Demand Generation for Non Metered
        • Demand/Bill Generation for Metered Connection
        • Household Register
        • Tabular Dashboard - Expense
        • Tabular Dashboard - Collection
        • Download Bills and Receipt
      • Architecture
        • Technology
      • Source Code
      • Documents
        • User Manual
        • Demo video
        • UI Mockups
        • mGramSeva UI
          • Application Permissions & Dependencies
        • Tech User Manual
          • Language Selection
          • Login
          • Update Password FTL
          • Forgot Password
          • Home
          • Edit Profile
          • Change Password
          • Generate Bill
          • Search Connection
          • Consumer Details
            • Create Consumer
            • Update Consumer
          • Expenses
            • Add Expenses
            • Search Expense Bills
            • Modify Expenses
          • Dashboard
            • Monthly Dashboard
            • Collections Dashboard
            • Expenditure Dashboard
          • Collect Payment
          • Consumer Feedback
          • Household Register
          • Bluetooth Thermal Printer Integration
          • Application Structure
        • Application Structure
        • Integration Testing
        • Integration Testing With Github Actions
        • Firebase Analytics Integration
        • Backend Services
          • mGramSeva - Water Services
          • mGramSeva - Water Service Calculator
          • mGramSeva e-Challan Service
          • mGramSeva - User Service
          • mGramSeva - Billing Service
          • mGramSeva - User OTP
          • iFix Adapter Integration Service
          • mGramSeva - Rollout Dashboard
          • mGramSeva Scheduler
          • mGramSeva- Services Re-Indexing
          • mGramSeva Dashboard
    • iFIX Adapter
      • Adapter Service Documents
        • iFIX Adapter Master Data Setup
        • mGramSeva iFIX Adapter Service
        • iFIX Adapter Master Data Service
        • iFix Adapter Services
      • Source Code
      • Installation
        • Local Setup
        • CI/CD
    • iFIX Dashboard
      • Features
      • Architecture
        • Technology
      • Source Code
      • Installation
        • Local Setup
        • CI/CD
      • Documents
        • iFIX Reference Dashboard
          • iFIX Fiscal Event Aggregator
  • Community
    • Ecosystem
      • News and Events
    • PFM Blogs
      • Why PFM Needs Fiscal Information Exchange Standards
      • Re-imagining Digital PFM in India
      • A Transformative Odyssey: The Impact of Smart Payments in Benefit Delivery
    • Discussions
    • Issues
Powered by GitBook

All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.

On this page
  • Pre-requisites
  • AKS Architecture
  • AKS Architecture For iFIX Setup
  • Understand the Resource Graph In Terraform Script
  • Custom Variables/Configurations
  • ​Run Terraform
  • Connect To The Cluster

Was this helpful?

Edit on GitHub
Export as PDF
  1. Platform
  2. Setup
  3. Infrastructure Setup

On Azure

PreviousOn AWSNextDeploy Services

Last updated 2 years ago

Was this helpful?

The Azure Kubernetes Service (AKS) is one of the Azure services used for deploying, managing, and scaling any distributed and containerized workloads. Here we can provision the AKS cluster on Azure from the ground up and using an automated way (infra-as-code) using and then deploy the DIGIT-iFIX Services config-as-code using .

This quickstart assumes a basic understanding of Kubernetes concepts. For more information, see .

If you don't have an , create a before you begin.

Pre-requisites

  • Use the Bash environment in .

  • If you prefer, the Azure CLI to run CLI reference commands.

    • If you're using a local installation, sign in to the Azure CLI by using the command. To finish the authentication process, follow the steps displayed in your terminal. For additional sign-in options, see .

    • When you're prompted, install Azure CLI extensions on first use. For more information about extensions, see .

    • Run to find the version and dependent libraries that are installed. To upgrade to the latest version, run .

  • This article requires version 2.0.64 or greater of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.

  • The identity you are using to create your cluster has the appropriate minimum permissions. For more details on access and identity for AKS, see .

  • Install on your local machine that helps you interact with the kubernetes cluster

  • Install that helps you package the services along with the configurations, envs, secrets, etc into a

  • Install version (0.14.10) for the Infra-as-code (IaC) to provision cloud resources as code and with desired resource graph and also it helps to destroy the cluster at one go.

Note: Run the commands as administrator if you plan to run the commands in this quickstart locally instead of in Azure Cloud Shell.

AKS Architecture

Before we provision the cloud resources, we need to understand and be sure about what resources need to be provisioned by terraform to deploy DIGIT. The following picture shows the various key components. (AKS, Worker Nodes, Postgres DB, Volumes, Load Balancer)

AKS Architecture For iFIX Setup

Considering the above deployment architecture, the following is the resource graph that we are going to provision using terraform in a standard way so that every time and for every env, it'll have the same infra.

  • AKS Azure (Kubernetes Service Master)

  • Work node group (VMs with the estimated number of vCPUs, Memory

  • Volumes (persistent volumes)

  • PostGres Database

  • Virtual Network

  • Users to access, deploy and read-only

Understand the Resource Graph In Terraform Script

  • Here we have already written the terraform script that provisions the production-grade DIGIT Infra and can be customized with the specified configuration.

git clone --branch release https://github.com/misdwss/iFix-DevOps.git
cd iFix-DevOps/infra-as-code/terraform


└── modules
    ├── db
    │   └── azure
    │       ├── main.tf
    │       ├── outputs.tf
    │       └── variables.tf
    ├── kubernetes
    │   └── azure
    │       ├── main.tf
    │       ├── outputs.tf
    │       └── variables.tf
    ├── node-pool
    │   └── azure
    │       ├── main.tf
    │       ├── outputs.tf
    │       └── variables.tf
    └── storage
        └── azure
            ├── main.tf
            ├── outputs.tf
            └── variables.tf
    ​

The following main.tf contains the detailed resource definitions that need to be provisioned, please have a look at it.

Dir: iFix-DevOps/Infra-as-code/terraform/aks-ifix-dev

provider "azurerm" {
  # whilst the `version` attribute is optional, we recommend pinning to a given version of the Provider
  version = "~>2.0"
  features {}
  subscription_id  = "71f67180-c7fb-43dd-988a-e9f9e3135adc"
  tenant_id        = "b36b0fbe-cea1-4178-8664-ba81a1e51765" 
  client_id = "${var.client_id}"
  client_secret = "${var.client_secret}"
}

resource "azurerm_resource_group" "resource_group" {
  name     = "${var.resource_group}"
  location = "${var.location}"
  tags = {
     environment = "${var.environment}"
  }
}

module "kubernetes" {
  source = "../modules/kubernetes/azure"
  environment = "${var.environment}"
  name = "${var.environment}"
  ssh_public_key = "~/.ssh/id_rsa.pub"
  location = "${azurerm_resource_group.resource_group.location}"
  resource_group = "${azurerm_resource_group.resource_group.name}"
  client_id = "${var.client_id}"
  client_secret = "${var.client_secret}"
  nodes = "1"
  vm_size = "Standard_DS2_v2"
}

module "node-group" {  
  for_each = toset(["ifix", "mgramseva"])
  source = "../modules/node-pool/azure"
  node_group_name     = "${each.key}ng"
  cluster_id          = "${module.kubernetes.cluster_id}"
  vm_size             = "Standard_D4ds_v4"
  nodes          = 2
}

module "zookeeper" {
  source = "../modules/storage/azure"
  environment = "${var.environment}"
  itemCount = "3"
  disk_prefix = "zookeeper"
  location = "${azurerm_resource_group.resource_group.location}"
  resource_group = "${module.kubernetes.node_resource_group}"
  storage_sku = "Premium_LRS"
  disk_size_gb = "5"
  
}

module "kafka" {
  source = "../modules/storage/azure"
  environment = "${var.environment}"
  itemCount = "3"
  disk_prefix = "kafka"
  location = "${azurerm_resource_group.resource_group.location}"
  resource_group = "${module.kubernetes.node_resource_group}"
  storage_sku = "Standard_LRS"
  disk_size_gb = "100"
  
}
module "es-master" {
  source = "../modules/storage/azure"
  environment = "${var.environment}"
  itemCount = "3"
  disk_prefix = "es-master"
  location = "${azurerm_resource_group.resource_group.location}"
  resource_group = "${module.kubernetes.node_resource_group}"
  storage_sku = "Premium_LRS"
  disk_size_gb = "2"
  
}
module "es-data-v1" {
  source = "../modules/storage/azure"
  environment = "${var.environment}"
  itemCount = "3"
  disk_prefix = "es-data-v1"
  location = "${azurerm_resource_group.resource_group.location}"
  resource_group = "${module.kubernetes.node_resource_group}"
  storage_sku = "Premium_LRS"
  disk_size_gb = "100"
  
}

module "kafka-ifix" {
  source = "../modules/storage/azure"
  environment = "${var.environment}"
  itemCount = "3"
  disk_prefix = "kafka-ifix"
  location = "${azurerm_resource_group.resource_group.location}"
  resource_group = "${module.kubernetes.node_resource_group}"
  storage_sku = "Standard_LRS"
  disk_size_gb = "100"
  
}

module "zookeeper-ifix" {
  source = "../modules/storage/azure"
  environment = "${var.environment}"
  itemCount = "3"
  disk_prefix = "zookeeper-ifix"
  location = "${azurerm_resource_group.resource_group.location}"
  resource_group = "${module.kubernetes.node_resource_group}"
  storage_sku = "Premium_LRS"
  disk_size_gb = "5"
  
}

module "postgres-db" {
  source = "../modules/storage/azure"
  environment = "${var.environment}"
  itemCount = "2"
  disk_prefix = "postgres-db"
  location = "${azurerm_resource_group.resource_group.location}"
  resource_group = "${module.kubernetes.node_resource_group}"
  storage_sku = "Premium_LRS"
  disk_size_gb = "20"
  
}

Custom Variables/Configurations

You can define your configurations in variables.tf and provide the environment-specific cloud requirements so that using the same terraform template you can customize the configurations.

├── aks-iFix-dev
│   ├── main.tf 
│   ├── outputs.tf
│   ├── providers.tf
│   ├── remote-state
│   │   └── main.tf
│   └── variables.tf

Following are the values that you need to mention in the following files, the blank ones will be prompted for inputs while execution.

## Add Cluster Name
variable "cluster_name" {
  default = "<Desired Cluster name>"  #eg: my-digit-aka
}
## Environment Name
variable "environment" {
    default = "<Desired Environment name>"  #eg: mgramsewa-qa
}
## Resource Group Name
variable "resource_group" {
    default = "<Desired Resource Group name>"  #eg: mgramsewa-qa
}
## Location Name
variable "location" {
    default = "<Desired Location name>"  #eg: southeastAsia
}

​Run Terraform

Now that we know what the terraform script does, the resources graph that it provisions and what custom values should be given with respect to your env.

Let's begin to run the terraform scripts to provision infra required to Deploy DIGIT on AZ.

  1. First CD into the following directory and run the following command 1-by-1 and watch the output closely.

cd DIGIT-DevOps/infra-as-code/terraform/aks-ifix-dev
terraform init
terraform plan
terraform apply

Upon Successful execution following resources gets created which can be verified by the command "terraform output"

  • Network: Virtual Network.

  • AKS cluster: with nodepool(s), master(s) & worker node(s).

  • Storage(s): for es-master, es-data-v1, es-master-infra, es-data-infra-v1, zookeeper, kafka, kafka-infra.

Connect To The Cluster

  1. az aks install-cli
    • Downloads credentials and configures the Kubernetes CLI to use them.

    az aks get-credentials --resource-group myResourceGroup --name myAKSClusteVerify the connection to your cluster using the  command. This command returns a list of the cluster nodes.

3. Finally, Verify that you are able to connect to the cluster by running the following command

kubectl config use-context <your cluster name>

kubectl get nodes

NAME                       STATUS   ROLES   AGE     VERSION
aks-nodepool1-31718369-0   Ready    agent   6m44s   v1.12.8 

Ideally, one would write the terraform script from the scratch using this .

Let's clone the GitHub repo where the terraform script to provision the AKS cluster is available and below is the structure of the files.

​ ​

To manage a Kubernetes cluster, use the Kubernetes command-line client, . kubectl is already installed if you use Azure Cloud Shell.

Install kubectl locally using the command:

Configure kubectl to connect to your Kubernetes cluster using the command. The following command:

Uses ~/.kube/config, the default location for the . Specify a different location for your Kubernetes configuration file using --file.

Whola! All set and now you can go with .

All content on this page by is licensed under a .

doc
iFix-DevOps
main.tf
variables.tf
kubectl
az aks install-cli
az aks get-credentials
Kubernetes configuration file
terraform
Helm
Kubernetes core concepts for Azure Kubernetes Service (AKS)
Azure subscription
free account
Azure Cloud Shell
install
az login
Sign in with the Azure CLI
Use extensions with the Azure CLI
az version
az upgrade
Access and identity options for Azure Kubernetes Service (AKS)
kubectl
Helm
kubernetes manifests
terraform
​
eGov Foundation
Creative Commons Attribution 4.0 International License
Creative Commons License
Deploy Product
Launch Cloud Shell in a new window