# Install Dragonfly as a Multi Node Cluster using k8s operator

**URL:** <https://dragonfly.discourse.group/t/install-dragonfly-as-a-multi-node-cluster-using-k8s-operator/234>\
**Category:** General\
**Created:** [December 9, 2024, 7:25am UTC](https://dragonfly.discourse.group/t/install-dragonfly-as-a-multi-node-cluster-using-k8s-operator/234 "2024-12-09T07:25:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![keshava88](https://yyz2.discourse-cdn.com/flex004/user_avatar/dragonfly.discourse.group/keshava88/32/83_2.png) [@keshava88](https://dragonfly.discourse.group/u/keshava88)\
**Post date:** [December 9, 2024, 7:25am UTC](https://dragonfly.discourse.group/t/install-dragonfly-as-a-multi-node-cluster-using-k8s-operator/234/1 "2024-12-09T07:25:32Z")

</div>

Hi,

I am evaluating dragonfly as an alternative to Redis.  
I am trying to figure out installation of dragonfly as a cluster using the dragonfly k8s operator.  
Could you guide me here?

---

<div class="post-metadata">

**Author:** ![joezhou\_df](https://yyz2.discourse-cdn.com/flex004/user_avatar/dragonfly.discourse.group/joezhou_df/32/82_2.png) [@joezhou\_df](https://dragonfly.discourse.group/u/joezhou_df)\
**Post date:** [December 10, 2024, 6:00pm UTC](https://dragonfly.discourse.group/t/install-dragonfly-as-a-multi-node-cluster-using-k8s-operator/234/2 "2024-12-10T18:00:06Z")

</div>

Hi @keshava88, welcome to the Dragonfly community.

Currently, the Dragonfly K8s Operator doesn’t support Dragonfly Cluster (the multi-node clustering) yet. The operator supports high availability (HA), though. A single Dragonfly primary instance is able to handle hundreds of GB or even 1TB of in-memory data. Depending on your workload and memory size, please let us know if a primary-replica HA setup is sufficient.

If you are already running Redis Cluster, Dragonfly supports the [emulated cluster mode](https://www.dragonflydb.io/docs/managing-dragonfly/cluster-mode#emulated-cluster). It’s a single Dragonfly primary (optionally with HA as well), but compatible Redis Cluster, so that it eases your migration. To enable emulated cluster mode using the K8s operator, please see the [documentation here](https://www.dragonflydb.io/docs/managing-dragonfly/operator/dragonfly-configuration) about the `args` field.

```yaml
spec:
  args:
   - "--cluster_mode=emulated"

```

If you really need to scale Dragonfly horizontally, Dragonfly Cluster is currently in **private beta** within [Dragonfly Cloud](https://dragonflydb.cloud/), our managed offering. Please contact us if that’s what you’re looking for.

---

<div class="post-metadata">

**Author:** ![thedukedk](https://yyz2.discourse-cdn.com/flex004/user_avatar/dragonfly.discourse.group/thedukedk/32/65_2.png) [@thedukedk](https://dragonfly.discourse.group/u/thedukedk)\
**Post date:** [December 11, 2024, 11:38am UTC](https://dragonfly.discourse.group/t/install-dragonfly-as-a-multi-node-cluster-using-k8s-operator/234/3 "2024-12-11T11:38:46Z")

</div>

@joezhou_df - I wonder if you could help me with a related question?

We spun up a Dragonfly with the operator on a K8s node for developer doing a .Net service which wanted a key/value store. We noticed the following output from the dragonfly logs.

> CLUSTER NODES failed with reason: Cluster is disabled. Enable via passing --cluster\_mode=emulated

So we added the arg `--cluster_mode=emulated` to the dragonfly instances.

But we do not really understand why we saw this and what impact setting cluster\_mode to emulated will have?

Is this some type of bad configuration on the client side?

The .Net client is using Redis.OM: [GitHub - redis/redis-om-dotnet: Object mapping, and more, for Redis and .NET](https://github.com/redis/redis-om-dotnet)

---

<div class="post-metadata">

**Author:** ![joezhou\_df](https://yyz2.discourse-cdn.com/flex004/user_avatar/dragonfly.discourse.group/joezhou_df/32/82_2.png) [@joezhou\_df](https://dragonfly.discourse.group/u/joezhou_df)\
**Post date:** [December 11, 2024, 6:20pm UTC](https://dragonfly.discourse.group/t/install-dragonfly-as-a-multi-node-cluster-using-k8s-operator/234/4 "2024-12-11T18:20:26Z")

</div>

Hi @thedukedk, let’s break the issue down:

- Redis Cluster requires a different version of client, namely a **cluster client** , which can be thought of as a superset of the ordinary Redis single-instance client. This is because Redis Cluster has a client-server-coordinated design.
- The cluster client provides the same data retrieval & manipulation commands (i.e., `GET`, `SET`), but it also supports additional commands for cluster coordination, normally not directly called by developers. For instance, the [`CLUSTER NODES`](https://redis.io/docs/latest/commands/cluster-nodes/) command is used to retrieve the cluster configuration from a server node or instance within the cluster.
- It’s likely the developer initiated the .NET client as a cluster client instead of a single-node client. So upon connecting, the cluster client needs to call the `CLUSTER NODES` command to gather cluster information.
- Dragonfly `--cluster_mode=emulated` helps migrate from a Redis Cluster to a Dragonfly single node, and it should have negligible impact in terms of performance.
- So, if you have code that was working with Redis Cluster, `--cluster_mode=emulated` should be used in Dragonfly, so that the existing cluster client works seamlessly with Dragonfly.
- But if this is a new project, then the developers should check the .NET client initialization again to make sure it’s creating a single-node client instead of a cluster client.

* * *

I am not very familiar with the .NET client library, but let’s take the [Go library](https://redis.uptrace.dev/guide/go-redis.html) as an example. Note that the same library supports multiple types of clients.

A single-instance (standalone) client should be created like this:

```go
import "github.com/redis/go-redis/v9"

client := redis.NewClient(&redis.Options{
	Addr: "localhost:6379",
	Password: "mypwd",
	DB: 0,
})

val, err := client.Get(ctx, "key").Result()

```

And a cluster client is created like this:

```go
import "github.com/redis/go-redis/v9"

client := redis.NewClusterClient(&redis.ClusterOptions{
    Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},
})

// Same usage after client initialization.
// Developers don't call commands like 'CLUSTER NODES'.
val, err := client.Get(ctx, "key").Result()

```

It might not be exactly the same for .NET, but you get the idea. I hope that’s clear and it solves your problem!

---

<div class="post-metadata">

**Author:** ![thedukedk](https://yyz2.discourse-cdn.com/flex004/user_avatar/dragonfly.discourse.group/thedukedk/32/65_2.png) [@thedukedk](https://dragonfly.discourse.group/u/thedukedk)\
**Post date:** [December 11, 2024, 7:06pm UTC](https://dragonfly.discourse.group/t/install-dragonfly-as-a-multi-node-cluster-using-k8s-operator/234/5 "2024-12-11T19:06:27Z")

</div>

That clears a lot up for me. Thank you sooo much!

I am more on the operations side of things. And Dragonfly is also a bit of a new technology for us.

I can pass this information along to the developer and we can dig into how to do this correctly for a single node client.

Again, thank you for taking the time. It is very much appreciated.
