ITOps v7.1 Application Deployment Process

Contents

  1. Important Terms  
  2.  ‎Prerequisites‎ 
  3. Download the installation package in Bastion VM 
  4. Validation of Product Infra before Application Install ‎ 
  5. Setting secrets in Azure Key Vault.  
  6. Create / Update Env JSON file 
  7. Fresh Install ITOps 
  8. HTTPS Enablement after Application Installation
  9. Creating Keys in Azure Key Vault for Data Encryption 
  10. Azure Disk Encryption in AKS
  11. Data Encryption of Azure Database for MySQL with a customer-managed key 
  12. Data Encryption of Azure Storage account using Customer Managed Key  ‎  
  13. Secondary download location: Azure Artifacts  
  14. List of containers for which autoscaling is enabled   ‎
  15. How to monitor Kubernetes deployments using K9s

Important Terms  

Bastion VM 

The Virtual Machine which has access to Kubernetes API server 

Base Infra 

The base Infrastructure which needs to be created before deploying product Infrastructure 

Product Infra 

The Kubernetes infrastructure required for respective product 

SmartInstall 

The Holistic Solution for deploying  SmartOps applications in Kubernetes infrastructure 

 

 ‎Prerequisites‎ 

 

Download the installation package in Bastion VM 

The Release packages are stored in SharePoint location and in azure artifacts. Please follow below steps for downloading. 

Primary Download location: Share point  

 

  1. Navigate to sharepoint location: https://ustglobal.sharepoint.com/teams/InnovationEngineering/Shared%20Documents/Forms/AllItems.aspx?viewid=f349a736%2D8a62%2D467f%2D8448%2D067be464bd59&id=%2Fteams%2FInnovationEngineering%2FShared%20Documents%2FKnowledge%20Management%2FSmartOps%20Deployment  

  2. Open the required release folder (eg:7.1.2) 

  3. Download the product zip and move it to the target VM 

 

Secondary download location: Azure Artifacts  

Prerequisite: Install az cli in the target deployment vm using below command:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash 

   

  1. Navigate https://dev.azure.com/USTInnovationEngineering/SmartOps/_packaging?_a=feed&feed=Smartops_Releases    

  2. Click on the required package.  
    Picture 1

  3. Click on Versions  

  4. Click on the options button (…) and select ‘Copy Install Command’. The download command will get copied to clipboard.
    Picture 3 

  5. Login to VM where you want to extract the package and execute the command.
    Picture 4

Note:  If its first time you will be prompted to install azure-devops extension. Give ‘Y’ and hit enter to continue.  

Validation of Product Infra before Application Install  

  1. Az MYSQL Firewall policies

    Picture 198 

  2.  Key vault permissions for the Azure AD user. 
    Picture 193

 

 

 

Key Vault Private Endpoint and its Private IP 

Picture 199 

Above Key Vault’s Private IP associated with respective Private Link of Key Vault 

Picture 11 

Update Private IP in Private Link  

 

Please refer below example from product invoiceext to update the Private link when it is missing. Please check for required product itops accordingly.

Picture 13 

 

Picture 14 

 

Picture 15 

 

Picture 16 

 

Prepare the bastion VM  
 

Install Tools: script to install prerequisite packages in bastion VM 

 

chmod +x installbastiontools.sh 

 

 

 

 

 

. / installbastiontools.sh 

 

 

 

 

Connect to cluster (Kube config configured)  

Picture 200 

 

Picture 206 

Pre-Check condition:  Please check Python 3.6 is installed in the bastion VM. [ SmartInstall runs on Python 3.6] 

Application Install 

 

Setting secrets in Azure Key Vault.  

Picture 19 

Azure Login from bastion VM 

Picture 20 

Once Signed in successfully, there will be message in the browser like below 
 

Picture 21 

 

 

 

 

Picture 23 

Create / Update Env JSON file 

 

 

 

 

 

 

Keys  

Sub Keys  

   

   

Suggested Values  

Info   

name  

   

   

   

stg01  

Name of the environment  

product  

   

   

   

itopstv1  

Name of product which needs to be deployed. Json file name in products folder.   

version  

   

   

   

7.1.2

Helm Chart version  

dnsName  

   

   

   

   

DNS name of the environment  

includeIngress  

   

   

   

true  

Ingress needs to be deployed or not  

ingressIp  

   

   

   

  

IP of Ingress  

isPrivateIngress  

   

   

   

true   

For Private Kubernetes cluster, the internal traffic is through internal Kubernetes loadbalancer.  

 

 

 

 

 

Do not change this setting if not for a specific use case.  

gpuEnabled  

   

   

   

false  

For Kubernetes cluster which needs GPU node pools  

helmRepoLocation  

   

   

   

../charts   

Helm repo location. Either smartops-helm repo or the charts folder inside the package  

defaultAppReplicaCount  

   

   

   

2  

Number for replicas of application containers  

secretProvider  

   

   

   

   

For managing kubernetes secrets  

   

azure  

   

   

   

Provider is Azure for K8s cluster deployed in Azure infrastructure  

   

tenantId  

   

   

   

Tenant ID of Azure subscription  

   

servicePrincipal  

   

   

   

Service principle client id and client secrets   

   

   

clientId  

   

   

  

   

   

clientSecret  

   

   

  

   

keyVaultName  

   

   

   

Azure keyvault name where the secrets are configured with its respective values  

autoScaling  

   

   

   

   

For critical applcation containers, autoscaling is enabled through kubernetes Horizontal Pod Autoscaler  

   

enabled  

   

   

true  

Set true to enable autoscaling for supported services.   

diskEncryption  

   

   

   

   

Encryption for Data at rest.   

   

enabled  

   

   

true  

  

   

azure  

   

   

   

Azure Disc Encryptionset ID.   

storage  

   

   

   

   

Details of various data stores.   

   

mysql  

   

   

   

   

   

   

host  

   

   

Azure MySQL instance name  

   

   

port  

   

   

Port number  

  

  

backup  

  

  

  

  

  

  

enabled  

true  

  

  

  

  

schedule  

0 2 * * *  

  

 

redis

 

 

 

 

 

 

host

 

 

Azure Cache Redis instance name

 

 

port

 

 

Port number

   

appFileStore  

   

   

   

   

   

   

azure  

   

   

Provider Azure   

   

   

storageAccount  

   

   

Storage account name for application files storage  

   

modelFileStore  

   

   

   

   

   

   

azure  

   

   

Provider Azure   

   

   

storageAccount  

   

   

Storage account where the pre-trained models are stored for various applications.   

   

backupFileStore  

   

   

   

   

   

   

azure  

   

   

Provider Azure   

   

   

storageAccount  

   

   

Storage account where backup files are stored  

   

mongo  

volumeSize  

   

   

Mongo instance details with the volume configuration, backup and its schedule.   

   

   

backup  

   

   

   

   

   

   

enabled  

true  

   

   

   

   

schedule  

0 2 * * *  

   

   

elasticsearch  

   

   

   

   

   

   

volumeSize  

   

   

Elasticsearch instance details with the volume configuration, backup and its schedule.   

   

   

backup  

   

   

  

   

   

   

enabled  

true  

  

   

   

   

schedule  

0 2 * * *  

  

   

rabbitmq  

   

   

   

   

   

   

volumeSize  

   

   

RabbitMQ instance details with the volume configuration, backup and its schedule.   

   

   

backup  

   

   

  

   

   

   

enabled  

true  

  

   

   

   

schedule  

0 2 * * *  

  

   

appStatefulSets  

   

   

   

Volume size configuration for application services which are statefulsets if any are there

   

   

volumeSize  

   

 16Gi  

   

   

   

   

   

   

   

   

   

   

   

   

   

logMonitoring  

   

   

   

   

Details for enabling log monitoring, log retention, cleanup and storage volume size.   

   

enabled  

   

   

true   

Recommended to set as true  

   

logRetentionInDays  

   

   

5   

For logs before the configured number of days will be automatically removed as per the cleanup cron schedule.   

   

logCleanUpCronSchedule  

   

   

 0 1 * * *  

Time duing which the retention job will run.   

 

 

 

 

 

 

   

logVolumeSize  

   

   

128Gi  

Immutable after first install.    

 

 

 

 

   

 

dataRestore  

databases  

   

   

   

This section applies only when smartinstall runs in restore mode. List of Data stores which needs to be restored  

   

mysqlBackupPath  

   

   

   

folder name inside Azure blob where mysql back up files are stored  

   

mysqlBackupFileName  

   

   

   

File name of mysql back up file  

   

mongoBackupPath  

   

   

   

folder name inside Azure blob where mongo back up files are stored  

   

mongoBackupFileName  

   

   

   

File name of mongo back up file  

   

elasticBasePath  

   

   

   

Path of Elasticsearch backup file in Azure blob  

   

minioBackupPath  

   

   

   

Folder name of Minio backup file in Azure blob  

   

rabbitmqBackupPath  

   

   

   

folder name inside Azure blob where RabbitMQ back up files are stored  

   

rabbitmqBackupFileName  

   

   

   

File name of RabbitMQ back up file  

   

restoreContainer  

   

   

   

Azure Blob container name where back up files are stored 

  

 

 

Fresh Install ITOps 

 

Once the packages are downloaded to bastion VM , execute below commands to Install the application without data restore 
 

 

python3 -u installWithDataInit.py --product ${product} --env ${environment} --kubecontext ${kubecontext} --verbose 

 

 

 

 

 

HTTPS Enablement after Application Installation

 

 

https://web.microsoftstream.com/video/fc814048-9405-423d-adca-22d28ecc30bc?list=trending

Appendix 

 

Appendix consists of the following sections 

 

 

 

 

 

 

 

 

 

 

Creating Keys in Azure Key Vault for Data Encryption 

For enabling Data Encryption for Azure MySQL, Storage Accounts and enabling Disk Encryption for Volumes in Kubernetes cluster, we need to create Encryption keys in Azure Key vault which is used to encrypt the data.  
 

Picture 209 
 

 


 

Picture 210 

 

Picture 36 

 

 

 

Azure Disk Encryption in AKS



Reference: https://docs.microsoft.com/en-us/azure/aks/azure-disk-customer-managed-keys 
‎ 
# Create a DiskEncryptionSet 
# key vault name, rg, etc needs to be changed accordingly 
#key key-smartops-k8s-disk-enc-001  ( key name given as an example ) needs to be created in Azure key Vault before creating the Disk Encryption Set  
 
keyVaultId=$(az keyvault show --name kv-engg-resrch-001 --query [id] -o tsv) 

keyVaultKeyUrl=$(az keyvault key show --vault-name kv-engg-resrch-001 --name key-smartops-k8s-disk-enc-001 --query [key.kid] -o tsv) 

az disk-encryption-set create -n smartops-k8s-des-001 -l eastus -g rg-smartopsengg-dev-001 --source-vault $keyVaultId --key-url $keyVaultKeyUrl 

 
Azure cloud shell 

Picture 37 

 

Ensure Get, Wrap and Unwrap permission is set for the disk encryption set to the key created in Az key vault. 

Picture 38 

 

 

 

 

Please refer des-platform-qa01 in above pic 

 
IMPORTANT: After creating the disk encryption set, select the disk encryption set and click on allow access to disk encryption key created in the key vault.  PFB pic 

Picture 39 

 

 

K8s storage class 
#currently kept as a part of env-setup template. Can be changed as required  

 

#diskEncryptionSetID values needs to be changed accordingly (  subscriptions, resourceGroups, diskEncryptionSets)  

kind: StorageClass 

apiVersion: storage.k8s.io/v1 

metadata: 

  name: pvc-ade-custom-storage-class 

provisioner: kubernetes.io/azure-disk 

parameters: 

  kind: Managed 

  skuname: Premium_LRS 

  diskEncryptionSetID: "/subscriptions/dfaa090f-c407-4e75-ac08-143cb932bdcf/resourceGroups/rg-smartopsengg-dev-001/providers/Microsoft.Compute/diskEncryptionSets/smartops-k8s-des-001" 

 
After deploying storage class, respective changes need to be made in statefulset’s pvcs referring to above custom storage class.  

Data Encryption of Azure Database for MySQL with a customer-managed key 

 

References:  
https://docs.microsoft.com/en-us/azure/mysql/howto-data-encryption-portal 

https://docs.microsoft.com/en-us/azure/mysql/concepts-data-encryption-mysql 

 

Key Encryption Key [ KEK ] 

Data Encryption Key [ DEK ] 

Symmetric key used to encrypt a block of data 

 

 

 

When you configure data encryption with a customer-managed key in Key Vault, continuous access to this key is required for the server to stay online. If the server loses access to the customer-managed key in Key Vault, the server begins denying all connections within 10 minutes. The server issues a corresponding error message and changes the server state to  Inaccessible. Some of the reason why the server can reach this state are: 
 

  

Limitations 

 

Steps 

Picture 40 

 
 

Picture 42 

 

Picture 43

 

 

 
Errors Observed while configuring  

If soft –delete is not enabled for keyvault , will get error like below  

Picture 44 

 

Picture 45 

 

 

 

Data Encryption of Azure Storage account using Customer Managed Key 
 

Steps 
 

Picture 211 

 

 

 

Picture 47 

 

 

 

 

 

 

 

 

Select the key vault and key by clicking ‘Select a key vault and key’  

Picture 48 

 

Picture 212 

 

 

 

 

 

Picture 50 

 

 

 

Secondary download location: Azure Artifacts  

 

 

  1. Navigate to https://dev.azure.com/USTInnovationEngineering/SmartOps/_packaging?_a=feed&feed=Smartops_Releases  

 

  1. Click on the required package.  

Picture 51 

  1. Click on Versions  

     

    Picture 213 

  2. Click on the options button (…) and select ‘Copy Install Command’. The download command will get copied to clipboard  

 

Picture 214 

 

  1. Login to VM where you want to extract the package and execute the command.Picture 54 

Please Note:  If its first time you will be prompted to install azure-devops extension. Give ‘Y’ and hit enter to continue. 

 

List of containers for which autoscaling is enabled  

Container name 

CPU Threshold 

min replicas 

max replicas 

clones-engine 

80% 

correlation

80% 

alertmapping

80% 

 

 

How to monitor Kubernetes deployments using K9s

 

K9s is installed when the installbastiontools.sh script is executed. Please refer

 

Staying in home directory execute below command to open K9s

K9s/k9s

Or

cd k9s

./k9s

Picture 217

 

Known Issues

Issues

Remarks

smartops-secrets stack failure

Secrets not correctly updated in Azure Key Vault or smartops-secrets chart

Restore failures

1.All databases should be deployed and running in healthy state
2. Databases secrets are correctly set in Azure key vault and the deployments can derive those values in the cluster
3. Env json storage account and file names should be updated correctly.
4. Connectivity issues to be mitigated with Azure key vault



FAQ

Ingress IP can be set via environment JSON file. Please refer ingressIp section in Environment JSON updates.

 

Please refer

Picture 218

 

 

Picture 219

Picture 220

 

 

K9s short key to delete a pod – < ctrl+d>

K9s documentation reference.