automq icon indicating copy to clipboard operation
automq copied to clipboard

[Question] Why does Automq use StatefulSet if brokers are stateless?

Open kincoy opened this issue 3 months ago • 5 comments

I’m deploying Automq in a Kubernetes cluster, according to Automq docs, brokers are stateless — all data is stored in external object storage like S3. But the official Helm chart uses a StatefulSet with PVCs.

This seems contradictory. Stateless apps usually use Deployment, not StatefulSet.

Questions: 1. Is there any real need for StatefulSet here (e.g. stable DNS, ordinal index)? 2. Are the PVCs strictly required, or can they be removed? 3. Can we safely switch to Deployment for simpler ops?

In my Kubernetes deployment, I found that the chart won’t work unless PVCs are provisioned, even though object storage is used. Looking to confirm this behavior before customizing the Helm chart.

Thanks!

kincoy avatar Sep 04 '25 11:09 kincoy

Great catch!

Currently, we deploy AutoMQ using existing systems like Bitnami or Strimzi, which utilize StatefulSet or similar resources. We’re simply leveraging this capability.

However, the question remains: can we theoretically deploy AutoMQ using Deployment?

It depends.

  • The KRaft controller is inherently stateful, so it should be deployed with StatefulSet.
  • For the broker, while we consider it stateless, it still maintains a basic state—namely, the NodeID. Each broker requires a unique ID. Currently, we use StatefulSet to assign the NodeID. However, if we modify this behavior, such as by reassigning IDs through the KRaft controller with a new API, we could potentially use Deployment instead.

Let me know if you have any further questions.

daniel-y avatar Sep 04 '25 11:09 daniel-y

Thanks for the clarification — using StatefulSet for stable NodeIDs makes sense.

Quick follow-up: Is there a way to avoid using PVCs entirely if we don’t need any local persistence (since all data is stored in object storage like S3)?

Eliminating PVCs would simplify ops quite a bit on our cloud setup.

Thanks again!

kincoy avatar Sep 04 '25 12:09 kincoy

You are welcome, we need to confirm if Bitnami supports this configuration. If it does, we can indeed avoid requesting PVs for the Broker.

daniel-y avatar Sep 04 '25 12:09 daniel-y

However, if we modify this behavior, such as by reassigning IDs through the KRaft controller with a new API, we could potentially use Deployment instead.

@daniel-y Any plans on doing so in upcoming releases? Yes, "avoid using PVCs entirely" would help everyone :)

chethanuk avatar Sep 09 '25 20:09 chethanuk

Hi @chethanuk , let's make a plan! Will update you soon,

daniel-y avatar Sep 11 '25 09:09 daniel-y