Azure AKS minimize costs for intermittent use

My team is investigating the use of AKS, we do this once a week for a few hours, been working like that for several weeks. So we only need the cluster up for a small block of time every week. Deleting and creating a new cluster every week is not ideal because we have to remember the settings.

So we’ve been just stopping the AKS VM’s of the cluster. But the storage still costs $6/day ($2/node). We would rather not loose the persistent store of each node so we can start next week where we left off. What is the best way to do this?

Perhaps we could snapshot the persistent stores, delete the stores (I have not checked but I imagine snapshots are a lot cheaper than active storage), and restore them when we start the VM’s, although it is not obvious right now how we would do this.

Or maybe if we snapshot the node volumes, and use the az cli to create the cluster, we could configure the cluster to create volumes from the snapshots. Doable?

Answer

You’re going to have difficulty deleting the VMs and recreating them, as they aren’t just VMs, they are also configured to work with your AKS instance as worker nodes, with all the certificates and configurations that go along with that.

You might be able to backup and then restore the VMs or the disks, but I suspect even then AKS is probably not going to be very happy about it, as it assumes that it is the one in control if creating and destroying worker nodes. You could look at creating an AKS cluster using VMSS works and scaling the scale set down as low as it will go, but then you definitely will lose any state you store on those nodes, although to be honest, you should be storing that in PVC’s (which you pay for the storage for) or outside of the cluster.

Ultimately my question would be, surely your time trying to work out ways to do this is worth more than the $180 a month your paying for the storage?

Attribution
Source : Link , Question Author : Oliver , Answer Author : Sam Cogan

Leave a Comment