Kubernetes is taking the IT world by storm – according to Red Hat, 68% of IT leaders are currently running containers in their organization, with nearly one-third planning to significantly increase usage within the year. With a projected market size of $7.8 billion by 2030, it's clear Kubernetes is here to stay.
However, recent findings from Pepperdata highlight one of the biggest challenges in the industry: surprise costs. The survey of IT leaders found that surprise costs ranked highest among key challenges, with nearly 60% experiencing significant or unexpected spending on computation, storage networking infrastructures and cloud-based IaaS. As the platform continues to permeate nearly every industry imaginable, managing unexpected costs is going to be top of mind for Kubernetes practitioners.
Prior to undertaking a Kubernetes deployment, IT leaders need to be aware of the potential pitfalls and how to address them, and optimizing costs might be the most important consideration. Kubernetes has the ability to run stateful workloads at scale and can even autoscale to achieve cost optimization in a more agile way. However, leaders must ensure their deployments meet the specific needs of the organizations, rather than a one-size-fits-all approach.
Once initial actions have been addressed, it's important for IT leaders to look at three ways to keep surprise costs low and optimize their spend, all without having to scale back on deployments.
1. Autoscale, Autoscale, Autoscale
Autoscaling helps IT leaders ensure that their containers are running in a stable way during times of peak demand, while keeping costs low during slower periods. Failure to implement autoscaling can result in a slow drain on resources, as users pay for resources that aren't being used during low demand hours, and even a freeze on the system (if it cannot keep up with peak demand).
According to Kubernetes.io, horizontal pod autoscaling (HPA) is a powerful tool that allows users to automatically scale the workload to meet demand. It tells the workload resource to either scale up or down – which is done by adding or reducing the number of pods, respectively – dependent on the current workload.
HPA is an incredibly effective way to manage resources and help IT leaders optimize the infrastructure of their clusters. For some, however, vertical pod autoscaling (VPA) may be a more attractive option. VPA assigns more resources to the pods that are already running for the workload, which is helpful for organizations that are unable to define a proper number of resources.
It's important to do research and understand which method is most effective for your business before implementing autoscaling policies, but both are useful to keep day-to-day costs steady.
2. Lowering Compute Costs with Spot Instances
Spot instances refer to computing capacity that isn't being used, usually sitting in the cloud or sometimes on-premises. Cloud providers need to have a certain amount of capacity available because they promise scalability to customers, but it often sits unused for flexibility purposes.
In some cases, Kubernetes users can actually receive large discounts from their provider by incentivizing them to use up this extra capacity, rather than letting it sit empty. The caveat is that the cloud providers can take the capacity back when they need it, and Kubernetes users would have to drain the pods in the cluster and return the capacity. Spot instances also require an upfront cost to reserve the instance, should you need it.
However, according to a D Zone and Kasten report, using spot instances properly can help users reduce their overall computer bill in the cloud by 65-90%. That's huge in terms of real dollars and is a really simple way to manage overall Kubernetes computing costs.
However, it's important to note that these cost savings can come at the risk of losing capacity when you need it. What's more important to you – ensuring total reliability all the time, or saving big on cloud costs to keep your deployments under budget? These are key questions to ask during the process.
Don't Forget to Reschedule!
The report also notes that configuring pod disruption budgets is a great way to avoid disruption in your Kubernetes workloads. But to start, make sure to reschedule your pods from time to time to ensure they're running at maximum efficiency.
Kubernetes is great about putting pods in the right spot at the right time, but they may be more efficient in other spots later on. Rescheduling your pods frequently to keep usage in the cluster running at optimal capacity is another simple way to optimize computing costs.
Kubernetes is a rapidly growing – and yet incredibly mature – industry that is beginning to touch all aspects of the business world. However it's clear that organizations are struggling to both anticipate and manage the additional costs that come with their complex workloads.
The impact of Kubernetes will only increase in the coming years, so it's important to arm yourself with the proper skills to stay ahead. Following these simple steps is a great way to begin, and beginners can also get up to speed quickly with various learning courses. Though the current knowledge gap in Kubernetes is a top issue facing developers and organizations as a whole, sharing what we know with our peers is the best way our community can support itself.