Skip to main content

Kafka

Kafka is an open-source platform for processing and transferring large data streams. With its scalability and fault-tolerance features, it lets users process their incoming data continuously and in real time. Kafka is an efficient, reliable choice for use cases such as data analysis, system monitoring, and integrating data from different sources.

With operators in the Arvancloud Cloud Container, you can fully set up and manage Kafka. These operators use version 0.41.0 of the Strimzi project.

Setting Up a Single-Node Ephemeral Kafka​

Save the following file with a name of your choice, such as kafka-ephemeral-cluster.yaml:

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
spec:
kafka:
version: 3.7.0
replicas: 1
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: tls
port: 9093
type: internal
tls: true
config:
offsets.topic.replication.factor: 1
transaction.state.log.replication.factor: 1
transaction.state.log.min.isr: 1
default.replication.factor: 1
min.insync.replicas: 1
inter.broker.protocol.version: "3.7"
storage:
type: ephemeral
zookeeper:
replicas: 3
storage:
type: ephemeral
entityOperator:
topicOperator: {}
userOperator: {}

Then run the following command to deploy it:

kubectl apply -f .yaml -n [namespace]

Replace [namespace] with your project's name in the Arvancloud Cloud Container.

Setting Up an Ephemeral Kafka Cluster​

Save the following file with a name of your choice, such as kafka-ephemeral.yaml:

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
spec:
kafka:
version: 3.7.0
replicas: 3
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: tls
port: 9093
type: internal
tls: true
config:
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
default.replication.factor: 3
min.insync.replicas: 2
inter.broker.protocol.version: "3.7"
storage:
type: ephemeral
zookeeper:
replicas: 3
storage:
type: ephemeral
entityOperator:
topicOperator: {}
userOperator: {}

Then run the following command to deploy it:

kubectl apply -f kafka-ephemeral.yaml -n [namespace]

Replace [namespace] with your project's name in the Arvancloud Cloud Container.

Setting Up a Single-Node Persistent Kafka​

Save the following file with a name of your choice, such as kafka-persistent-single.yaml:

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
spec:
kafka:
version: 3.7.0
replicas: 1
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: tls
port: 9093
type: internal
tls: true
config:
offsets.topic.replication.factor: 1
transaction.state.log.replication.factor: 1
transaction.state.log.min.isr: 1
default.replication.factor: 1
min.insync.replicas: 1
inter.broker.protocol.version: "3.7"
storage:
type: jbod
volumes:
- id: 0
type: persistent-claim
size: 100Gi
deleteClaim: false
zookeeper:
replicas: 1
storage:
type: persistent-claim
size: 100Gi
deleteClaim: false
entityOperator:
topicOperator: {}
userOperator: {}

Then run the following command to deploy it:

kubectl apply -f kafka-persistent-single.yaml -n [namespace]

Replace [namespace] with your project's name in the Arvancloud Cloud Container.

Setting Up a Persistent Kafka Cluster​

Save the following file with a name of your choice, such as kafka-persistent.yaml:

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: my-cluster
spec:
kafka:
version: 3.7.0
replicas: 3
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: tls
port: 9093
type: internal
tls: true
config:
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
default.replication.factor: 3
min.insync.replicas: 2
inter.broker.protocol.version: "3.7"
storage:
type: jbod
volumes:
- id: 0
type: persistent-claim
size: 10Gi
deleteClaim: false
zookeeper:
replicas: 3
storage:
type: persistent-claim
size: 20Gi
deleteClaim: false
entityOperator:
topicOperator: {}
userOperator: {}

Then run the following command to deploy it:

kubectl apply -f kafka-persistent.yaml -n [namespace]

Replace [namespace] with your project's name in the Arvancloud Cloud Container.

For more details and examples, see the Kafka operator documentation.