Optimizing Kubernetes Costs with Multi-Tenancy and Virtual Clusters
October 16, 2024

Cliff Malmborg
Loft Labs

The cost of running Kubernetes at scale with a large number of users quickly becomes untenable for cloud-native organizations. Monitoring costs, either via public cloud providers or with external tools such as Kubecost, is the first step to identifying important cost drivers and areas of improvement. Setting efficient resource limits with Resource Quotas and Limit Ranges, and enabling horizontal and vertical autoscaling, can also help reduce costs and inform optimization strategy.

However, these traditional methods are not enough given today's complex distributed systems, with many organizations spinning up huge numbers of underutilized clusters. To truly reduce Kubernetes costs and simplify management in the long-term, teams should consider a new approach: multi-tenancy with virtual Kubernetes clusters.

Reducing the Number of Clusters

Implementing multi-tenancy helps cut costs because the Kubernetes control plane and computing resources can be shared by several users or applications, which also reduces the management burden. Many organizations deploy too many clusters, even one for every developer, and stand to save significantly by relying on a multi-tenant architecture.

Reducing the number of clusters improves resource utilization and reduces redundancies, as API servers, etcd instances, and other components of the control plane will not be duplicated unnecessarily, but shared by workloads in the same cluster. Multi-tenancy also reduces cluster management fees, which are charged by public cloud providers. When running many small clusters, the management fee cost of about $70 per month per cluster can quickly become overwhelming.

In traditional multi-tenant architectures, engineers might receive self-service namespaces on a shared cluster. Given their limited utility and poor isolation between namespaces, opting for virtual clusters instead can preserve all the benefits of "real" clusters in a more efficient, secure multi-tenant setup. Virtual clusters are fully functional Kubernetes clusters running within an underlying host cluster. Unlike namespaces, virtual clusters have separate Kubernetes control planes and storage backends. Only core resources like pods and services are shared with the physical cluster, while all others such as statefulsets, deployments, and webhooks exist only in the virtual cluster.

Virtual clusters thus solve the "noisy neighbor" problem as they provide better workload isolation than namespaces, and developers can configure their virtual cluster independently tailored to their specific requirements. Because configurations and new installations can be carried out on virtual clusters themselves, the underlying host cluster can remain simple with only the basic components, which improves stability and reduces the chance for errors. While virtual clusters may not completely replace the need for separate regular clusters, implementing multi-tenancy with virtual clusters makes it possible to greatly reduce the number of real clusters needed to operate at scale.

The Case for Virtual Clusters to Reduce Cost

Virtual clusters are an exciting new alternative to both namespaces and separate clusters; cheaper and easier to deploy than regular clusters, with much better isolation than namespaces. Crucially, shifting to virtual clusters is a simple process that in most cases will not disrupt development workflows. For example, a large organization with developers distributed across 25 teams may choose to provision 25 separate Kubernetes clusters to test and develop the application. To switch to virtual clusters, they would instead simply create a single Kubernetes cluster and then deploy 25 virtual clusters within it. From the developers' viewpoint, nothing changes — teams can utilize all the necessary services within their virtual clusters, deploying their own resources like Prometheus and Istio without affecting the host cluster.

Further, since virtual clusters and their workloads are also pods in the host cluster, teams can take full advantage of the Kubernetes scheduler. If a team will not be using a virtual cluster for a period of time, there will not be pods scheduled in the host cluster using resources; overall, improved node resource utilization will drive down costs. Automating the process of scaling down unused resources can also eliminate costs created by idle virtual clusters. This "sleep mode" means the environment is stored and can be spun up quickly once a developer needs it again. Developers can implement a sleep mode via scripts or with tools that have built-in functionality.

Another key benefit is that infrastructure teams can centralize services like ingress controllers, service meshes, and logging tools, installing them just once in the host cluster and letting all virtual clusters share access. When organizations have trust in their tenants, like internal teams, CI/CD pipelines, and even select customers, replacing underutilized clusters with virtual ones can significantly cut down infrastructure and operational costs.

Future-Proofing Systems with Virtual Cluster Multi-Tenancy

Traditional Kubernetes cost management techniques, like autoscaling and monitoring tools, are a good first step to reducing runaway cloud spend tied to Kubernetes. But as companies rush to deploy artificial intelligence workloads, the associated complexity and resource demands will quickly render typical Kubernetes setups unmanageable and prohibitively expensive. Making the shift to virtual clusters now will provide the same levels of security and functionality, but will drastically reduce the operational and financial burden as organizations will need far fewer clusters. A virtualized, multi-tenant Kubernetes architecture is well-positioned to scale to the demands of modern applications.

Cliff Malmborg is Director of Product Marketing at Loft Labs
Share this

Industry News

November 20, 2024

Spectro Cloud completed a $75 million Series C funding round led by Growth Equity at Goldman Sachs Alternatives with participation from existing Spectro Cloud investors.

November 20, 2024

The Cloud Native Computing Foundation® (CNCF®), which builds sustainable ecosystems for cloud native software, has announced significant momentum around cloud native training and certifications with the addition of three new project-centric certifications and a series of new Platform Engineering-specific certifications:

November 20, 2024

Red Hat announced the latest version of Red Hat OpenShift AI, its artificial intelligence (AI) and machine learning (ML) platform built on Red Hat OpenShift that enables enterprises to create and deliver AI-enabled applications at scale across the hybrid cloud.

November 20, 2024

Salesforce announced agentic lifecycle management tools to automate Agentforce testing, prototype agents in secure Sandbox environments, and transparently manage usage at scale.

November 19, 2024

OpenText™ unveiled Cloud Editions (CE) 24.4, presenting a suite of transformative advancements in Business Cloud, AI, and Technology to empower the future of AI-driven knowledge work.

November 19, 2024

Red Hat announced new capabilities and enhancements for Red Hat Developer Hub, Red Hat’s enterprise-grade developer portal based on the Backstage project.

November 19, 2024

Pegasystems announced the availability of new AI-driven legacy discovery capabilities in Pega GenAI Blueprint™ to accelerate the daunting task of modernizing legacy systems that hold organizations back.

November 19, 2024

Tricentis launched enhanced cloud capabilities for its flagship solution, Tricentis Tosca, bringing enterprise-ready end-to-end test automation to the cloud.

November 19, 2024

Rafay Systems announced new platform advancements that help enterprises and GPU cloud providers deliver developer-friendly consumption workflows for GPU infrastructure.

November 19, 2024

Apiiro introduced Code-to-Runtime, a new capability using Apiiro’s deep code analysis (DCA) technology to map software architecture and trace all types of software components including APIs, open source software (OSS), and containers to code owners while enriching it with business impact.

November 19, 2024

Zesty announced the launch of Kompass, its automated Kubernetes optimization platform.

November 18, 2024

MacStadium announced the launch of Orka Engine, the latest addition to its Orka product line.

November 18, 2024

Elastic announced its AI ecosystem to help enterprise developers accelerate building and deploying their Retrieval Augmented Generation (RAG) applications.

Read the full news on APMdigest

November 18, 2024

Red Hat introduced new capabilities and enhancements for Red Hat OpenShift, a hybrid cloud application platform powered by Kubernetes, as well as the technology preview of Red Hat OpenShift Lightspeed.

November 18, 2024

Traefik Labs announced API Sandbox as a Service to streamline and accelerate mock API development, and Traefik Proxy v3.2.