Provisioning the K8s cluster
command to create AKS cluster:
az aks create --resource-group <resouse-group-name> --node-resource-group <k8s-resource-group-name> --name <cluster name> --node-count 4 --admin-username deployer --kubernetes-version 1.19.9 --service-principal "<service principal id>" --node-vm-size Standard_D4s_v3 --client-secret "<client id>" --network-plugin azure --ssh-key-value @deployer.pub -l <region> --vm-set-type VirtualMachineScaleSets --vnet-subnet-id /subscriptions/<subscription id>/resourceGroups/<resouse-group-name>/providers/Microsoft.Network/virtualNetworks/<vnet-name>/subnets/<subnet name>
Get the kubeconfig file for your cluster with the below command:
az aks get-credentials --resource-group <resource group name> --name <cluster name> --file k8s.yaml
Creating deployment manifests for a microservice. Jenkinsfile, Ansible role, helm chart
sample helm chart: https://github.com/project-sunbird/sunbird-devops/tree/release-5.1.0/kubernetes/helm_charts/core/content
jenkins file: https://github.com/project-sunbird/sunbird-devops/blob/release-5.1.0/kubernetes/pipelines/deploy_core/Jenkinsfile
ansible role: https://github.com/project-sunbird/sunbird-devops/tree/release-5.1.0/kubernetes/ansible/roles/sunbird-deploy
Autoscaling of micro services and cluster
Deploy HPA for service and enable autoscaling on AKS cluster.
Enable auto scaling on cluster using cli or azure console.
az aks update \ --resource-group myResourceGroup \ --name myAKSCluster \ --enable-cluster-autoscaler \ --min-count 1 \ --max-count 3
Cluster backup and Restore
https://github.com/project-sunbird/sunbird-devops/discussions/2112