github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/applications/kafka/README.md (about)

     1  # Overview
     2  
     3  This image chooses OpenEBS LocalPV as its persistence storage engine.
     4  
     5  Components included in this image:
     6  
     7  * 3 StatefulSet replicas for kafka which requests "10Gi" storage.
     8  * 1 StatefulSet replica for the zookeeper which requests "10Gi" storage.
     9  
    10  ## How to use it
    11  
    12  Kafka can be accessed by consumers via port 9092 on the following DNS name from within your cluster:
    13  
    14  ```
    15  my-kafka.kafka-system.svc.cluster.local
    16  ```
    17  
    18  Each Kafka broker can be accessed by producers via port 9092 on the following DNS name(s) from within your cluster:
    19  
    20  ```
    21  my-kafka-0.my-kafka-headless.kafka-system.svc.cluster.local:9092
    22  ```
    23  
    24  To create a pod that you can use as a Kafka client run the following commands:
    25  
    26  ```
    27  kubectl run my-kafka-client --restart='Never' --image docker.io/bitnami/kafka:2.8.0-debian-10-r61 --namespace kafka-system --command -- sleep infinity
    28  kubectl exec --tty -i my-kafka-client --namespace kafka-system -- bash
    29  
    30  PRODUCER:
    31      kafka-console-producer.sh \
    32          --broker-list my-kafka-0.my-kafka-headless.kafka-system.svc.cluster.local:9092 \
    33          --topic test
    34  
    35  CONSUMER:
    36      kafka-console-consumer.sh \
    37          --bootstrap-server my-kafka.kafka-system.svc.cluster.local:9092 \
    38          --topic test \
    39          --from-beginning
    40  ```
    41  
    42  ## How to rebuild it use helm
    43  
    44  Kubefile:
    45  
    46  ```shell
    47  FROM registry.cn-qingdao.aliyuncs.com/sealer-apps/openebs-localpv:2.11.0
    48  # add helm repo and run helm install
    49  RUN helm repo add bitnami https://charts.bitnami.com/bitnami
    50  # set persistence.storageClass=local-hostpath, which is provided by base image openebs-localpv:2.11.0.
    51  CMD helm install my-kafka --create-namespace --namespace kafka-system --set global.storageClass=local-hostpath bitnami/kafka --version 14.0.5
    52  ```
    53  
    54  run below command to build it
    55  
    56  ```shell
    57  sealer build -t {Your Image Name} -f Kubefile -m cloud .
    58  ```
    59  
    60  More parameters see [official document here](https://artifacthub.io/packages/helm/bitnami/kafka).