Containers and Kubernetes are getting popular and enterprises are moving their monolithic applications to micro service architecture. There for enterprise use Docker, Kubernetes & etc, to run their micro service application. With the demand and popularity gain for container orchestration to manage thousands of containers, Kubernetes has the biggest market share and its the accepted container platform for many organization.
With the increasing popularity to Kubernetes cloud providers such as Azure, AWS, GCP introduce managed Kubernetes service for customers. There for some organizations use multi cloud providers to deploy applications and services.
To manage Kubernetes clusters in multi cloud scenario organization faced a difficulty of managing different consoles and tools. Rancher Kubernetes Management is a tool we can use to manage all your clusters from On-Premise to cloud from one console.
Lets see in action how to configure Rancher and Add AKS cluster to it.
Before get started following prerequisites are needed.
- Azure Account – Deploy Rancher & and AKS
- kubectl – command line tool to interact with Kubernetes
- Azure CLI or PowerShell – Deploy ARM Template
- VS Code – Code Editor
Deploy Rancher VM Deployment
To deploy the Rancher VM, we use Azure ARM template. In ARM template we specify the resources need to create a Ubuntu VM and for installation of Docker we use Azure VM extensions. ARM template has two files, RancherVM.json & Rancher-Node-Parameters.json.
RancherVM.json file contains the resources deployed to Azure. It includes resources such as Virtual Network, VM, NIC etc.
Rancher-Node-Parameters.json file contains any parameters need for resources define in RancherVM.json
Following is the ARM templates for Rancher VM deployment.
To deploy the ARM templates we can use following Azure CLI commands
After deployment succeed we can access the Rancher Management Tool using public IP of the Azure VM or Domain name.
First thing we need to do is change administrators password.
After setup the password Rancher will prompt the server URL as below. This URL can be used to
Next it will load the Rancher dashboard as below, currently its empty and we’ll add a existing AKS cluster to it in upcoming steps.
Click “Add Cluster” to get start with adding existing or create new cluster
Select “Import” as above to add clusters already created.
As above mentioned first we need to create ClusterRoleBinding to user account of the AKS with cluster-admin ClusterRole attached (Step 1)
Next we need to run kubectl YAML manifest (Step 2) to create relevant resources need for communication with Rancher. Bellow are the resources created by above YAML manifest.
Next we can verify the Deployment and DemonSet is created by running following Command
kubectl get pods -n cattle-system
After few minutes we can see the data are coming to Rancher dashboard as shown below. Time may very based on the cluster size.
All are set and as an administrator or developer we can deploy application and manage, AKS cluster as we need. One additional configuration we can do is enable monitoring for resources. Click “Enable Monitoring to see live metrics” in top right corner.
Next we need to configure the monitoring parameters as below
Above I use persistent storage to store Grafana and Prometheus data. Configure to store data retention for 12 hours.
After configurations completed dashboard will update as below.
We can click Grafana icon to open a Grafana dashboard for metrics.
Additional we can see metrics of the cluster as below.