Unlock your Kubernetes to run custom resource based microservices in any scale

Table of Contents
The Rise of Custom Resources and Their Challenges
I don’t need to introduce Kubernetes in this post, as it is the de facto standard for running microservices at scale. Kubernetes provides a robust infrastructure not only for running workloads, but also for exposing services, securing applications, configuring authorization, and much more. The introduction of custom defined resources extended Kubernetes’ capabilities, enabling developers to implement custom services and controllers without worrying about the underlying infrastructure. This innovation promised faster development and portability. Over the past few years, custom resources and operators/controllers have become increasingly popular. Crossplane marked another significant shift, allowing management of resources outside the cluster.
However, custom controllers face significant challenges when handling large volumes of data. Kubernetes relies on ETCD for all data storage, which limits scalability, flexibility, and performance for complex or high-volume workloads. What are the main issues?
- ETCD is designed for configuration data, and cluster size is limited.
- ETCD’s consistency model means all members are full replicas, and Kubernetes only connects to the leader.
- ETCD cannot filter data at the storage level; the Kubernetes API server must fetch all records and filter them client-side.
- With a single ETCD instance, both cluster configuration and custom data are mixed. High-load custom services can block or delay normal cluster operations, risking overall cluster health.
- Kubernetes is multi-tenant with isolation methods, but ultimately all data is stored in a single database. A database outage affects the entire cluster, and a malicious attacker could potentially access everything.
These are some of the reasons why custom resources and controllers are used to solve infrastructure problems, and why high-volume data applications are often avoided.
We are not without hope…
The Future of Data Management on Kubernetes
Before discussing the solution, let’s highlight the limitations of custom resource controllers in Kubernetes.
Limitation | Description |
---|---|
Eventual Consistency | Updates may not be immediately visible across the system |
Non-Transactional | No support for ACID transactions |
Relational Logic | Complex joins or relations between data entities are not supported |
Limited Data Filtering | No advanced query engine included within Kubernetes |
💡 Don’t worry, the Kubernetes API aggregation layer can help overcome the limitations of the core API server by allowing you to extend the API with custom APIs that are served by a separate backend, or extension API server. This setup enables you to implement specific logic and capabilities that aren’t available in the core API.
It’s time to meet HariKube. HariKube is a middleware that transparently distributes database load across multiple vendor-agnostic databases, delivering low latency, high throughput, and a true cloud-native development experience. It achieves exceptional performance through data distribution and optimized database routing. By offloading resource-intensive workloads from ETCD, HariKube ensures consistent responsiveness and operational efficiency at scale. It enables strict data separation across namespaces, resource types, or services—helping organizations meet security and compliance requirements without sacrificing scalability or performance. Additionally, HariKube simplifies developer workflows by abstracting infrastructure complexity. Developers can focus on data structures and business logic while the platform handles data routing and storage. HariKube is fully transparent; Kubernetes does not notice it is not communicating with an ETCD instance. You can use vanilla Kubernetes for development with limited data, and deploy HariKube in production to handle large datasets and distribute data across multiple backends.
HariKube supports multiple backends, each with different capabilities for data access and filtering. The table below outlines which storage engines are compatible and whether they support storage-level filtering for efficient querying. Find full list of databases here.
Getting Started
First, configure your databases in docker-compose.yml
.
|
|
Run the following command to start the databases.
|
|
Next, create a data routing configuration file called topology.yml
.
|
|
Routing Configuration Explained:
- ETCD with regular expression routing: Routes events to an ETCD store.
- MySQL endpoint with namespace matching: All objects in the
kube-system
namespace are routed to a MySQL backend. - PostgreSQL endpoint with prefix matching: All pod resources—except pods in the
kube-system
namespace—are routed to a PostgreSQL backend. - SQLite endpoint for specific custom resources: Routes all resources of type
shirts
in the groupstable.example.com
to a lightweight embedded SQLite database. - All other objects are stored in the default SQLite database.
After preparing the environment, start the middleware.
HariKube images aren’t public yet. If you’d like to try them, request a trial version on the Get Started page.
Start by authenticating your local Docker client with the private registry at registry.harikube.info
. This step is essential for pulling images from the registry.
|
|
|
|
The final step is to start the Kubernetes cluster. As mentioned, HariKube is transparent to Kubernetes and works out of the box. However, supporting large datasets requires recompiling the Kubernetes API Server and Controller Manager. You can follow the guide here, but for simplicity, this tutorial uses Kind with vanilla Kubernetes.
Create a Kind config in kind-config.yml
.
|
|
Start the cluster with:
|
|
You can validate that HariKube has distributed your data according to the topology configuration:
|
|
Now, create your first custom resource. Apply the definition file:
|
|
Then add a few resources:
|
|
You can verify that HariKube has stored all shirts
in the selected SQLite database:
|
|
That’s it! Imagine your own data topology and enhance your Kubernetes experience. Enjoy lower latency, higher throughput, data isolation, virtually unlimited storage, and simplified development. HariKube supports both flat and hierarchical topologies, allowing you to organize your databases like leaves on a tree.
Thank you for reading, and feel free to share your thoughts.