Skip to main content
KubeBlocks is a cloud-native database management operator that simplifies the deployment and management of databases on Kubernetes. This guide demonstrates how to deploy and manage FalkorDB using the KubeBlocks operator.

What is KubeBlocks?

KubeBlocks is an open-source Kubernetes operator designed to manage stateful workloads, particularly databases. It provides:
  • Unified Management: Manage multiple database engines through a consistent API
  • Day-2 Operations: Automated scaling, backup, restore, monitoring, and failover
  • Production-Ready: Built for production environments with high availability
  • Multi-Topology Support: Standalone, replication, and sharding configurations

Prerequisites

Before you begin, ensure you have:

Installing KubeBlocks

If you haven’t installed KubeBlocks yet, follow these steps:

Step 1: Install KubeBlocks Operator

Wait for KubeBlocks to be ready:

Step 2: Install FalkorDB Addon

Enable the FalkorDB addon for KubeBlocks. You can use either the kbcli command-line tool or Helm. First, install kbcli:
Then install the FalkorDB addon:

Option B: Using Helm

Step 3: Create a Namespace

Create a dedicated namespace for your FalkorDB instances:

Deployment Options

KubeBlocks supports three deployment topologies for FalkorDB:
  1. Standalone - Single instance for development and testing
  2. Replication - High availability with primary/secondary nodes and Sentinel
  3. Sharding - Horizontal scalability with multiple shards (Redis Cluster mode)

Option 1: Standalone Deployment

A standalone deployment is ideal for development, testing, or small workloads.

Create a Standalone Cluster

Create a file named falkordb-standalone.yaml:
Apply the configuration:
Monitor the cluster creation:
A replication deployment provides high availability with automatic failover using Redis Sentinel.

Understanding the Architecture

The replication topology includes:
  • FalkorDB Component: Primary and secondary nodes for data storage and queries
  • Sentinel Component: Monitors FalkorDB nodes and manages automatic failover
  • Minimum of 3 Sentinel Replicas: Required for quorum-based failover decisions

Create a Replication Cluster

Create a file named falkordb-replication.yaml:
Apply the configuration:

Why Does Sentinel Start First?

KubeBlocks ensures that Sentinel instances start before FalkorDB replicas. This is because:
  1. Each FalkorDB replica queries Sentinel on startup to determine if a primary node exists
  2. If no primary exists, the replica configures itself as the primary
  3. If a primary exists, the replica configures itself as a secondary and begins replication
This startup sequence is defined in the ClusterDefinition and ensures proper cluster initialization.

Verify the Deployment

Check the cluster status:
Expected output shows one primary and one or more secondary pods.

Option 3: Sharding Deployment

A sharding deployment distributes data across multiple shards for horizontal scalability.

Create a Sharding Cluster

Create a file named falkordb-sharding.yaml:
Apply the configuration:
This creates a cluster with 3 shards, each having 2 replicas (1 primary + 1 secondary).

Connecting to FalkorDB

Step 1: Get Connection Credentials

Retrieve the password for your FalkorDB instance:

Step 2: Port Forward to the Cluster

Enable local access to the FalkorDB service:

Step 3: Connect Using redis-cli

Connect to your FalkorDB instance:

Step 4: Run a Test Query

Execute a simple Cypher query to verify the connection:

Day-2 Operations

KubeBlocks provides comprehensive Day-2 operations for managing your FalkorDB clusters.

Horizontal Scaling

Scale Out

Add more replicas to your cluster:
Apply the scaling operation:

Scale In

Remove replicas from your cluster:
Alternatively, update the cluster directly:

Vertical Scaling

Update CPU and memory resources:

Volume Expansion

Expand storage volume (requires storage class with volume expansion support):

Restart Cluster

Restart all components:

Stop and Start

Stop the cluster (releases pods but retains storage):
Start the cluster:

Configuration Management

Reconfigure Parameters

Update FalkorDB configuration dynamically:
Some parameters (like maxclients) require a restart. KubeBlocks will handle this automatically. Verify the configuration:

Backup and Restore

Create a Backup Repository

Before creating backups, configure a backup repository:

Full Backup

Create a full backup using Redis BGSAVE:
Apply the backup:
Check backup status:

Continuous Backup (Point-in-Time Recovery)

Enable continuous backup using AOF (Append-Only File):
  1. Enable AOF timestamps:
  1. Update the BackupSchedule to enable AOF backup:
Set enabled: true for the aof backup method.

Restore from Backup

Restore a new cluster from a backup:

Exposing Services

Expose via LoadBalancer

Expose FalkorDB to external clients:
For different cloud providers, use appropriate annotations:

Expose via NodePort

For on-premises or development environments:

Monitoring with Prometheus

Enable Metrics Export

Ensure metrics are enabled when creating the cluster:

Create PodMonitor

Create a PodMonitor to scrape metrics:
Apply the PodMonitor:

Access Grafana Dashboard

  1. Access your Grafana instance
  2. Import a Redis/FalkorDB dashboard from the Grafana dashboard store
  3. Configure the dashboard to use the correct job label (e.g., monitoring/falkordb-replication-pod-monitor)

Best Practices

High Availability

  • Use the replication topology with at least 3 Sentinel replicas
  • Distribute pods across availability zones using pod anti-affinity
  • Configure appropriate resource requests and limits
  • Enable automated backups with appropriate retention policies

Security

  • Use Kubernetes secrets for storing passwords
  • Enable TLS for client connections (if required)
  • Use Network Policies to restrict access to FalkorDB pods
  • Regularly rotate credentials

Performance

  • Choose appropriate storage class with good I/O performance
  • Monitor resource usage and scale vertically/horizontally as needed
  • For write-heavy workloads, consider disabling AOF timestamps
  • Use sharding topology for large datasets

Storage

  • Ensure storage class supports volume expansion
  • Configure appropriate storage size based on expected data growth
  • Use persistent volumes with replication for data durability
  • Test backup and restore procedures regularly

Troubleshooting

Cluster Not Ready

If the cluster status remains Creating for an extended period:

Connection Issues

If you cannot connect to FalkorDB:

Backup Failures

If backups fail:

Deleting the Cluster

To delete a cluster and all its resources:
Note: WipeOut policy deletes all data including backups. Use Delete policy to retain backups.

Additional Resources

Summary

KubeBlocks provides a powerful, production-ready solution for deploying and managing FalkorDB on Kubernetes. With support for multiple topologies, comprehensive Day-2 operations, and automated backup/restore capabilities, KubeBlocks simplifies the operational complexity of running FalkorDB in Kubernetes environments. Whether you need a simple standalone instance for development or a highly available sharded cluster for production, KubeBlocks has you covered.

Frequently Asked Questions

KubeBlocks requires Kubernetes >= v1.21. Ensure you also have kubectl and helm installed before deploying.
KubeBlocks supports standalone (single instance for development), replication (master + replicas with Sentinel for HA), and sharding (Redis Cluster mode for horizontal scalability).
Create an OpsRequest with type: HorizontalScaling to add or remove replicas, or type: VerticalScaling to change CPU and memory resources. KubeBlocks handles the operation automatically.
Yes. KubeBlocks supports full backups via RDB (BGSAVE) and continuous backups via AOF for point-in-time recovery. Configure a BackupRepo (e.g., S3) and create Backup resources.
Retrieve the password from the Kubernetes secret (falkordb-replication-conn-credential), then use kubectl port-forward or expose via LoadBalancer/NodePort. Connect with redis-cli -a <password>.