1. github 地址
  2. 下载文件方便后续使用
wget https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.33.2/strimzi-0.33.2.tar.gz

tar -xzf strimzi-0.33.2.tar.gz
  1. 安装 strimzi-cluster-operator
kubectl create ns kafka

kubectl create -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka

# 等待pod启动完成
kubectl get pods -n kafka
  1. 部署kafka
cp strimzi-0.33.2/examples/kafka/kafka-persistent.yaml ./


# 根据需求更改 kafka-persistent.yaml 例如修改存储大小和使用nodeport端口
vim kafka-persistent.yaml
-----------------------------------
...
spec:
  kafka:
    version: 3.4.0
    replicas: 3
    listeners:
      - name: external
        port: 9094
        type: nodeport
        tls: false
        configuration:
          bootstrap:
            nodePort: 30091
          brokers:
           - broker: 0
             nodePort: 30092
           - broker: 1
             nodePort: 30093
           - broker: 2
             nodePort: 30094
      - name: plain
        port: 9092
        type: internal
        tls: false
      - name: tls
        port: 9093
        type: internal
        tls: true
...
    storage:
      type: jbod
      volumes:
      - id: 0
        type: persistent-claim
        size: 10Gi
        deleteClaim: false
...
...
-----------------------------------

kubectl apply -f kafka-persistent.yaml -n kafka
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐