How can I improve cost efficiency of Azure Kubernetes?

2024-11-20T09:27:50.7333333+00:00

I am creating a suite of online services. To better control database usage and scalability, I selected AKS as the platform to host my various services. This includes database pods, API pods, Blazor app pods, Keycloak, and more.

At the moment, my app is in its development infancy. I have no users and just a few pods. I created what I believed to be a lightweight node pool in AKS, but the VMs behind the scenes are costing me close to CA$1,000 per month. That's untenable. What is an optimal configuration of AKS to minimize costs while still being performant and scalable? Is AKS even the right tool?

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,186 questions
{count} votes

3 answers

Sort by: Most helpful
  1. David Singh 0 Reputation points
    2024-11-20T10:33:38.1633333+00:00

    You can do following 1. Use smaller VMs like B-series or spot VMs for cost savings.

    1. Enable Cluster Autoscaler and Horizontal Pod Autoscaler.
    2. Separate workloads into optimized, independent node pools.
    3. Set resource requests and limits to avoid overprovisioning.
    4. Use Reserved Instances or Savings Plans for predictable workloads.
    5. Monitor resources with Azure Monitor or tools like Kubecost.
    6. Use Azure Dev/Test subscription for discounts.
    7. Pause or shut down unused node pools during development.
    8. Consider alternatives like Azure App Service or Container Apps
    9. Regularly review costs with Azure Cost Management tools.
    0 comments No comments

  2. Srinud 2,985 Reputation points Microsoft Vendor
    2024-11-20T18:00:28.7566667+00:00

    Hi Cost efficiency with Azure Kubernetes,
    Thank you for reaching out to us on the Microsoft Q&A forum.
    In addition to the @David Singh please follow the steps below when creating your cluster to reduce the cost of your AKS cluster:

    Use the Cluster Autoscaler to automatically scale the number of nodes in your AKS cluster based on actual resource usage. This will help reduce costs during periods of low demand.

    Ensure that each pod's CPU and memory resource requests and limits are properly configured. Proper resource limits ensure that Kubernetes schedules your pods more efficiently, avoiding both over-provisioning and underutilization of resources.

    Configure the Horizontal Pod Autoscaler (HPA) in your AKS cluster to dynamically scale the number of pods based on CPU, memory usage, or custom metrics. This allows your system to scale according to demand without over-provisioning resources.

    If the environment is for development or testing purposes, check if you're eligible for Azure Dev/Test pricing. This offers significant discounts on various Azure resources including VMs and AKS.

    Enable cluster autoscaling to automatically adjust the number of nodes in each pool based on demand. This helps reduce the cost of unused nodes during idle times.

    Please find the below documents for more information:

    If the information is helpful, please consider by clicking the "Upvote and Accept answer" on the post.


  3. akinbade abiola 20,145 Reputation points
    2024-11-23T05:35:30.83+00:00

    If your workload is predictable and exists for an extended period of time, consider purchasing an Azure Reservation to further reduce your resource costs..

    I would also recommend taking a look at these articcles to help imporve cost in AKS:

    https://learn.microsoft.com/en-us/azure/aks/best-practices-cost

    https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/scenarios/app-platform/aks/cost-governance-with-kubecost?source=recommendations

    https://learn.microsoft.com/en-us/azure/aks/operator-best-practices-storage

    https://learn.microsoft.com/en-us/azure/aks/cluster-autoscaler-overview#best-practices-and-considerations

    You can mark it 'Accept Answer' and 'Upvote' if this helped you

    Regards,

    Abiola

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.