Deploying AutoMQ for production environment workloads and tuning its parameters are relatively complex. You can contact the AutoMQ team via the form here to obtain the necessary assistance and best practices.
Prerequisites
This document example is used to deploy a 4-node AutoMQ cluster, where 3 nodes run Controller ( Controller and Broker), and the remaining 1 node runs only Broker. The following conditions need to be checked in advance:- Prepare a Kubernetes cluster, ensure it has at least 4 Nodes, and it is recommended to use network-optimized virtual machines with 2 cores and 16GB of memory, on which Pod creation and other operations will be performed later.
- Ensure that the Helm Chart version is v3.8.0 or higher. Refer to Helm Chart Quick Start.
- Prepare 2 Object Storage Buckets, one for storing message data and one for storing system logs and Metric data.
Strimzi provides multiple types of Operators. Unless otherwise specified below, all references refer to the Cluster Operator.
Deploy Strimzi Operator
Step 1: Edit the configuration file
Create an emptystrimzi-values.yaml
file, which is recommended to be consistent with the example configuration strimzi-values.yaml , and then add additional parameters as needed.
Strimzi supports multiple Kafka-related components, and AutoMQ is mainly adapted to the KAFKA
component, and currently only supports version 3.9.0.
Step 2: Install the Strimzi Operator
Use the configuration file just created and install the Strimzi Operator viahelm install
.
- Specify
version
as 0.47 to ensure stability and avoid unnecessary issues.
Deploy AutoMQ Cluster
Step 1: Edit the configuration file
Create an emptyautomq-demo.yaml
file, edit the file, and add specific parameters. You can refer to the recommended configuration examples for different scenarios under automq-demo.yaml and its subdirectories. For more details, refer to README.md.
-
Replace
${ops-bucket}
,${data-bucket}
,${region}
,${endpoint}
with the specific values of Object Storage. For details, see Object Storage Configuration . -
Replace
${access-key}
and${secret-key}
with actual values. You can also choose other authorization methods such as IAM Role. -
Multi-Available Zone deployment can use the
topologySpreadConstraints
parameter to ensure that Pods are evenly distributed across specified Available Zones.
- Avoid cross-Available Zone traffic. The following configuration will obtain the topology.kubernetes.io/zone of the current node label, ultimately achieving the effect of eliminating cross-Available Zone traffic costs.
- Disable the shrinkage check. Enabling this configuration allows automq to quickly complete shrinkage, and details can be found in the volume expansion and contraction section below.
- It is recommended to deploy AutoMQ exclusive nodes at the production level (to avoid competing for resources such as internet bandwidth with other Pods), and it is advisable to match them through labels for node affinity and tolerations.
-
Other server level parameters can be set as needed in
spec.kafka.config
. For details, please refer to: Broker and Controller Configuration.
Step 2: Install AutoMQ
Install AutoMQ using the customautomq-demo.yaml
file
Test message sending and receiving
- When accessing the Kafka cluster within the k8s cluster, the format of its server address is:
my-cluster-kafka-bootstrap:9092
For details, see: Strimzi ref list of kafka cluster resources strNext, you can perform Topic message sending and consumption tests based on
kafka-console-producer.sh
, kafka-console-consumer.sh
.
- Start the producer and test sending messages (the topic will be automatically created by default):
- Start the consumer and test receiving messages:
Uninstall
- After completing the test, you can stop and uninstall the Strimzi Operator via
helm uninstall
.
- Stop and uninstall automq
- If historical data is no longer needed, the PVC and Bucket data of the cluster must be deleted together to prevent Dirty Data from affecting the next deployment.
Precautions for the production environment
Fix the Strimzi Operator version
To avoid unexpected changes during deployment, it is recommended to fix the Strimzi Operator version to0.47
. This helps:
- Ensure Compatibility : Ensure that the behavior of the deployed application is consistent with that in testing and is not affected by the release of new versions.
- Avoid accidental updates : Prevent automatic updates from introducing changes that are incompatible with current deployment or operational practices.
Namespace Management
The Strimzi Operator is only responsible for managing AutoMQ clusters created within the namespace where it resides (e.g., automq). The Operators of Apache Kafka and AutoMQ should be deployed in different Namespaces. To avoid conflicts, it is recommended to create a new Namespace when using AutoMQ, and completely delete this Namespace after use .Docker mirroring
The Strimzi Operator uses the Kafka 3.9 version mirroring address by default as quay.io/strimzi/kafka:latest-kafka-3.9.0
, which needs to be modified to the AutoMQ custom mirroring and specific version:
Storage Class
In this example, we are using AWS’s gp2 storage type. If you are using non-AWS or have different requirements, you can make adjustments based on the actual situation.Autobalancer Configuration
The autobalancer
in PLAINTEXT mode must explicitly configure parameters in the following format: listener.name - port
.
Scheduling Policy
Through node affinity (nodeAffinities) and toleration (tolerations), fine-grained scheduling policies can be implemented for AutoMQ in Kubernetes. We recommend that production-level AutoMQ be exclusive and non-mixed workload. It is recommended to customize label matching rules based on node types:Tolerance
It is recommended to add taints to the Kubernetes node group key: "dedicated", operator: "Equal", value: "automq", effect: "NoSchedule"
.
Node Affinity
Override the default values in the controller/broker configuration to match node labels (such asnode-type: r6in.large
)
Pod Anti-Affinity
Ensure that the controller component and the broker component are not scheduled to the same node, using thepodAntiAffinity
parameter:
Volume Expansion and Contraction
Controller
The number of Controller instances is specified through thecontroller.replicas
configuration item, and currently does not support horizontal volume expansion and contraction. It is recommended to configure 3 instances, but it can be adjusted according to actual needs.
Note: After the Clustered Deployment is completed, adjusting the Replicas of the Controller is not currently supported to avoid unexpected risks.
Broker
The number of instances is configured through broker.replicas
, supporting horizontal volume expansion and contraction.
Note that the following parameters must be configured during volume contraction:
skip-broker-scaledown-check
to skip this check.
Since AutoMQ adopts the Shared Storage architecture , this parameter can be enabled without the risk of data loss.
For details, see: Strimzi prevent broker scale down if containing partition replicas