Money Saving tips for AKS Cluster
Kubernetes is amazing to work with. It saves a lot of time and effort. Kubernetes is present and future! With all it perks we can say that it’s somewhat future-proof!
The more we practice and work with Kubernetes, better hold we get on this technology. However an important thing to keep in mind is that this technology is not free and running Kubernetes involves creating clusters which itself signals expensive.
Learning and experimenting with Kubernetes means keeping the clusters running most of the time and this can quickly eat up your system resources if you are running on local.
So what’s the solution? Running Kubernetes on cloud! On cloud you don’t have to manage the clusters and you can get started in no time. And if you are someone who loves Azure, the Azure Kubernetes Service (AKS) is just for you! I prefer doing all my R&Ds on the cloud as it saving lot of time required for setup and you can work while utilizing all the benefits of cloud infra. You can check more about Azure Kubernetes Service (AKS) here.
Here AKS is a free managed container service is but the nodes in the cluster you create to work on are paid. The minimum number of node you need to work on AKS is ONE.
Now lets see find out the cheapest VM size for our node size in AKS cluster. After extensive research, we can conclude that the most cheapest and minimum suited VM size for testing with AKS is B-series.
Now coming on to cost saving strategy for your AKS Cluster for your non-production or practice environments, Azure provides a wonderful feature to do that. You can actually STOP YOUR AKS CLUSTER! Yes can stop your AKS cluster when you are not using it. And when you stop it, you end up saving the cost of that cluster too! This way you can run your cluster when you need it and stop it once you are not working on it.
To stop your AKS Cluster using Azure CLI, you can run the following command:
$ az aks stop \
--resource-group <resource_group> \
--name <aks>
Note: If you can delete your entire cluster, you can end up saving even more.
Now let’s do the math for cost saving. If you are running your cluster for 24 hours 7 days a week, then you would end up spending somewhere around $9.87. (As per Azure Pricing Calculator).
24 * 7 = 168 hours
Cost for running AKS cluster with managed OS Disk for 168 hours = $8.33 + $1.54 = $9.87
Now if you decide to stop the cluster when not in use and are running your cluster for 10 hours 7 days a week, then you would end up spending somewhere around $2.03. (As per Azure Pricing Calculator).
10 * 7 = 70 hours
Cost for running AKS cluster with managed OS Disk for 70 hours = $0.50 + $1.54 = $2.03
Cost Savings
So using this tip you’ll end up saving somewhere around $7.84 per week. (As per Azure Pricing Calculator.)
Note: There might be cost for some additional components like AppGateway, Loadbalancer, VitualNetwork, etc when you are working with AKS Cluster hence the cost will vary from the above estimates but the idea of cost savings using the tip would prevail and help in the objective.