Kubernetes ์œ„์— Kafka Cluster ๊ตฌ์ถ•ํ•˜๊ณ , Kafka UI ์›น ์ฝ˜์†”๋กœ ์ ‘๊ทผํ•˜๊ธฐ!

13 minute read

๋“ค์–ด๊ฐ€๋ฉฐ

ํšŒ์‚ฌ์—์„œ Confluent๋ฅผ ํ†ตํ•ด Kafka ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ž˜ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ, ์ด ์นดํ”„์นด์— ๋Œ€ํ•ด์„œ ์ข€๋” ์ž์„ธํžˆ ์•Œ๊ณ , ์ „๋ฌธ์„ฑ์„ ๊ฐ–์ถ”๊ณ  ์‹ถ๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“ค์–ด์„œ 2025๋…„ ์ฒซ ๋ชฉํ‘œ๋กœ Confluent์˜ Kafka ์ž๊ฒฉ์ฆ์ธ Confluent Certified Developer for Apache Kafkaยฎ ์ž๊ฒฉ์ฆ์„ ์ค€๋น„ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค โœŒ๏ธ

์ง€๊ธˆ๊นŒ์ง€ Confluent ์œ„์—์„œ Saas๋กœ๋งŒ Kafka๋ฅผ ์šด์˜ํ•ด๋ณธ ๊ฒƒ ๊ฐ™์•„์„œ, ์‹œํ—˜๋„ ์ค€๋น„ํ•ด๋ณผ๊ฒธ! Kubernetes์—์„œ Kafka Cluster๋ฅผ ์šด์˜ํ•ด๋ณด๋ฉฐ ์ด๋ฆฌ์ €๋ฆฌ ๋ง›๋ณด๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค ใ…Žใ…Ž

์ผ๋‹จ ๋””ํ”Œ๋กœ์ด๋ฅผ ํ•ด๋ณด์ž!

์ €๋Š” ์ฃผ๋กœ Helm Chart๋กœ ์›Œํฌ๋กœ๋“œ๋ฅผ ๋””ํ”Œ๋กœ์ดํ•˜๊ธฐ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ์—๋„ Helm Chart๋ฅผ ์ด์šฉํ•ด Kafka๋ฅผ ๋””ํ”Œ๋กœ์ด ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค! ์•„๋ž˜์™€ ๊ฐ™์ด helmfile.bitnami-kafka.yaml์„ ์ค€๋น„ํ•ฉ๋‹ˆ๋‹ค.

# @helmfile.bitnami-kafka.yaml
repositories:
  - name: bitnami
    url: https://charts.bitnami.com/bitnami

releases:
  - name: bitnami-kafka
    namespace: kafka
    chart: bitnami/kafka
    version: 31.1.1
    values:
      - ./values.bitnami-kafka.yaml

bitnami/kafka ์ฐจํŠธ ๊ทธ๋Œ€๋กœ ๋””ํ”Œ๋กœ์ด ํ•ด๋„ ๋ฉ๋‹ˆ๋‹ค๋งŒ, ๊ทธ๋Œ€๋กœ ํ•˜๋‹ˆ Kraft ๋ชจ๋“œ๋กœ ๋””ํ”Œ๋กœ์ด ๋˜๋”๋ผ๊ตฌ์š”! ์ €๋Š” ์ผ๋‹จ Zookeeper ๋ชจ๋“œ๋ถ€ํ„ฐ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๊ธฐ ์œ„ํ•ด ์ปค์Šคํ…€์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค! ๊ทธ๋ž˜์„œ values.bitnami-kafka.yaml ํŒŒ์ผ์„ ๋งŒ๋“ค๊ณ  ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

# @values.bitnami-kafka.yaml
zookeeper:
  enabled: true
  replicaCount: 1

broker:
  replicaCount: 3

controller:
  replicaCount: 0

kraft:
  enabled: false

ํฌ์ŠคํŠธ๋ฅผ ์ฒ˜์Œ ์ž‘์„ฑํ•  ๋•Œ๋Š” broker.replicaCount=1๋กœ ์„ค์ • ํ–ˆ์Šต๋‹ˆ๋‹ค๋งŒโ€ฆ ๊ทธ๋ ‡๊ฒŒ ํ•˜๋‹ˆ ๋‚˜์ค‘์— ๋‚ด๋ถ€์šฉ ํ† ํ”ฝ์ธ __consumer_offsets ํ† ํ”ฝ ๋งŒ๋“ค๋•Œ, replication.factor=3 ๋•Œ๋ฌธ์— ์ปจ์Šˆ๋จธ ์ชฝ์— ์˜ค๋ฅ˜๊ฐ€ ์ƒ๊ธฐ๋”๋ผ๊ตฌ์š”โ€ฆ ๊ทธ๋ž˜์„œ ์‹œํ–‰์ฐฉ์˜ค๋ฅผ ์›์น˜ ์•Š์œผ์‹ ๋‹ค๋ฉด broker.replicaCount=3์œผ๋กœ ์‹œ์ž‘ํ•˜๊ธธ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค!

๊ทธ๋ฆฌ๊ณ  ์•„๋ž˜ ๋ช…๋ น์–ด๋กœ ๋””ํ”Œ๋กœ์ด ํ•˜๋ฉด

$ helmfile -f helmfile-kafka.yaml apply`
...
** Please be patient while the chart is being deployed **

Kafka can be accessed by consumers via port 9092 on the following DNS name from within your cluster:

    bitnami-kafka.kafka.svc.cluster.local

Each Kafka broker can be accessed by producers via port 9092 on the following DNS name(s) from within your cluster:

    bitnami-kafka-broker-0.bitnami-kafka-broker-headless.kafka.svc.cluster.local:9092

The CLIENT listener for Kafka client connections from within your cluster have been configured with the following security settings:
    - SASL authentication

To connect a client to your Kafka, you need to create the 'client.properties' configuration files with the content below:

security.protocol=SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-256
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
    username="user1" \
    password="$(kubectl get secret bitnami-kafka-user-passwords --namespace kafka -o jsonpath='{.data.client-passwords}' | base64 -d | cut -d , -f 1)";

To create a pod that you can use as a Kafka client run the following commands:

    kubectl run bitnami-kafka-client --restart='Never' --image docker.io/bitnami/kafka:3.9.0-debian-12-r4 --namespace kafka --command -- sleep infinity
    kubectl cp --namespace kafka /path/to/client.properties bitnami-kafka-client:/tmp/client.properties
    kubectl exec --tty -i bitnami-kafka-client --namespace kafka -- bash

    PRODUCER:
        kafka-console-producer.sh \
            --producer.config /tmp/client.properties \
            --bootstrap-server bitnami-kafka.kafka.svc.cluster.local:9092 \
            --topic test

    CONSUMER:
        kafka-console-consumer.sh \
            --consumer.config /tmp/client.properties \
            --bootstrap-server bitnami-kafka.kafka.svc.cluster.local:9092 \
            --topic test \
            --from-beginning
$ kgp
NAME                        READY   STATUS    RESTARTS      AGE
bitnami-kafka-zookeeper-0   1/1     Running   0             100s
bitnami-kafka-broker-0      1/1     Running   2 (35s ago)   100s
bitnami-kafka-broker-2      1/1     Running   2 (35s ago)   100s
bitnami-kafka-broker-3      1/1     Running   2 (35s ago)   100s

์งœ์ž”! zookeeper ํ•˜๋‚˜์™€ broker ํ•˜๋‚˜๊ฐ€ ๋””ํ”Œ๋กœ์ด ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

์ด๊ฒŒ zookeeper๋ž‘ broker๊ฐ€ ๊ฐ™์ด ๋œจ๊ฒŒ ๋˜๋Š”๋ฐ, zookeeper๊ฐ€ ์•„์ง ์ค€๋น„๋˜์ง€ ์•Š์€ ์ƒํƒœ์—์„œ broker๊ฐ€ ๋””ํ”Œ๋กœ์ด ๋˜์–ด์„œ broker๊ฐ€ ๋ช‡๋ฒˆ RESTART ํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, zookeeper๊ฐ€ ๋””ํ”Œ๋กœ์ด ๋˜๋ฉด broker๋„ ๊ณง RUNNING ์ƒํƒœ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค ใ…Žใ…Ž

๊ทธ๋ฆฌ๊ณ  ๋ญ”๊ฐ€ ์„ค๋ช…๋“ค์ด ์ญ‰ ๋‚˜์˜ค๋Š”๋ฐ์š”! ๋””ํ”Œ๋กœ์ด ํ•œ Kafka ํด๋Ÿฌ์Šคํ„ฐ์— ์ ‘์†ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์ ํ˜€ ์žˆ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

Letโ€™s Access the cluster!

๋””ํ”Œ๋กœ์ดํ•œ Kafka ํด๋Ÿฌ์Šคํ„ฐ์— ์ ‘์†ํ•ด๋ด…์‹œ๋‹ค! Kafka ํด๋Ÿฌ์Šคํ„ฐ์— ์ ‘์†ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์—ฌ๋Ÿฌ ๊ฐ€์ง€๊ฐ€ ์žˆ์ง€๋งŒ! ์ œ๊ฐ€ Kafka CLI ๋Œ€์‹  ํŽธํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” kcat์„ ํ†ตํ•ด ํ•œ๋ฒˆ ์ ‘์†ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

# port-forward๋ฅผ ๋จผ์ € ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.
$ kubectl port-forward svc/bitnami-kafka -n kafka 9092:9092
...
$ kcat -b localhost:9092 -L \
-X security.protocol=SASL_PLAINTEXT \
-X sasl.mechanisms=SCRAM-SHA-256 \
-X sasl.username=user1 \
-X sasl.password=PASSWORD
Metadata for all topics (from broker -1: sasl_plaintext://localhost:9092/bootstrap):
 1 brokers:
  broker 100 at bitnami-kafka-broker-0.bitnami-kafka-broker-headless.kafka.svc.cluster.local:9092 (controller)
 0 topics:

sasl.password ๊ฐ’์€ ์•„๊นŒ bitnami/kafka๋ฅผ ๋””ํ”Œ๋กœ์ด ํ•œ ํ›„์— ๋‚˜์˜จ ๊ฐ€์ด๋“œ์˜ ๋ช…๋ น์–ด๋กœ ๊ฐ€์ ธ์˜ค๋ฉด ๋ฉ๋‹ˆ๋‹ค.

$ kubectl get secret bitnami-kafka-user-passwords --namespace kafka -o jsonpath='{.data.client-passwords}' | base64 -d

Kafka UI ๋””ํ”Œ๋กœ์ด

Kafka UI

๋””ํ”Œ๋กœ์ดํ•œ Kafka ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ข€๋” ํŽธํ•˜๊ณ  ์‰ฝ๊ฒŒ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด Kafka UI๋ฅผ ์ถ”๊ฐ€๋กœ ๋””ํ”Œ๋กœ์ด ํ•ฉ๋‹ˆ๋‹ค. ์š”๊ฑด Apache Kafka์˜ ๊ณต์‹ ์ปดํฌ๋„ŒํŠธ๋Š” ์•„๋‹ˆ์ง€๋งŒ! Confluent ํ”Œ๋žซํผ ์ฒ˜๋Ÿผ Kafka ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์›น ์ฝ˜์†”์—์„œ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ค๋‹ˆ๋‹ค! ๐Ÿซฐ

๋””ํ”Œ๋กœ์ด๋ฅผ ์œ„ํ•ด ์ผ๋‹จ helmfile์„ ์•„๋ž˜์™€ ๊ฐ™์ด ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค.

# @helmfile.kafka-ui.yaml
repositories:
  - name: kafka-ui
    url: https://provectus.github.io/kafka-ui-charts

releases:
  - name: kafka-ui
    namespace: kafka
    chart: kafka-ui/kafka-ui
    version: 0.7.6
    values:
      - ./values.kafka-ui.yaml

๊ทธ๋ฆฌ๊ณ  values.kafka-ui.yaml์— bitnami-kafka์— ์ ‘์†ํ•˜๊ธฐ ์œ„ํ•œ SASL ๋กœ๊ทธ์ธ ์ •๋ณด๋ฅผ ๊ธฐ์ž… ํ•ฉ๋‹ˆ๋‹ค.

# @values.kafka-ui.yaml
yamlApplicationConfig:
  kafka:
    clusters:
      - name: bitnami-kafka
        bootstrapServers:  bitnami-kafka.kafka.svc.cluster.local:9092
        properties:
          security.protocol: SASL_PLAINTEXT
          sasl.mechanism: SCRAM-SHA-256
          sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="user1" password="PASSWORD";
  auth:
    type: disabled

  management:
    health:
      ldap:
        enabled: false

๋งˆ์ฐฌ๊ฐ€์ง€๋กœ SASL password๋Š” bitnami-kafka ํด๋Ÿฌ์Šคํ„ฐ ์ƒ์„ฑ ๋•Œ, ๋ฐœ๊ธ‰ํ•œ K8s Secret์˜ ๊ฐ’์„ ๊ฐ€์ ธ์™€ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  helmfile apply๋กœ ๋””ํ”Œ๋กœ์ด ํ•œ ํ›„์—! port-forward๋กœ kafka-ui๋ฅผ http://localhost:8080์—์„œ ์ ‘์†ํ•ด๋ด…์‹œ๋‹ค!

$ kubectl get svc -n kafka
NAME                               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
bitnami-kafka-broker-headless      ClusterIP   None            <none>        9094/TCP,9092/TCP            122m
bitnami-kafka-zookeeper-headless   ClusterIP   None            <none>        2181/TCP,2888/TCP,3888/TCP   122m
bitnami-kafka-zookeeper            ClusterIP   10.43.190.250   <none>        2181/TCP                     122m
bitnami-kafka                      ClusterIP   10.43.176.10    <none>        9092/TCP                     122m
kafka-ui                           ClusterIP   10.43.177.29    <none>        80/TCP                       7s

$ kubectl port-forward svc/kafka-ui -n kafka 8080:80

Kafka UI

ใ…Žใ…Ž ์š”๋ ‡๊ฒŒ Kafka ํด๋Ÿฌ์Šคํ„ฐ์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์›น ์ฝ˜์†”๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค!

Kafka UI์— Kafka ๋ธŒ๋กœ์ปค ์„œ๋ฒ„ ์™ธ์—๋„ Zookeeper๋‚˜ Schema Registry, Ksql๋„ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ €๋„ ์ด๋ฒˆ ํฌ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜๋ฉด์„œ ์ฒ˜์Œ ์‚ฌ์šฉํ•ด๋ณด์•˜๋Š”๋ฐ์š”! ์ถ”ํ›„์— Kafka UI๋ฅผ ์š”๋ฆฌ์กฐ๋ฆฌ ๋œฏ์–ด๋ณด๊ณ  ํฌ์ŠคํŠธ๋ฅผ ๋˜ ํ•˜๋‚˜ ์ž‘์„ฑํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

Kafka UI์™€ Kafka ํด๋Ÿฌ์Šคํ„ฐ์— ์—ฐ๊ฒฐ์— ๋Œ€ํ•œ ๋” ์„ธ๋ถ€์ ์ธ ๋‚ด์šฉ์ด ํ•„์š”ํ•˜๋‹ค๋ฉด, Kafka UI์˜ ์š” ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•˜์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค ๐Ÿ‘‰ kafka-ui/Misc configuration properties

๋™์ž‘ ํ…Œ์ŠคํŠธ

๋””ํ”Œ๋กœ์ดํ•œ Kafka ํด๋Ÿฌ์Šคํ„ฐ๊ฐ€ ์ž˜ ๋™์ž‘ํ•˜๋Š”์ง€ ํ…Œ์ŠคํŠธ ํ•ด๋ด…์‹œ๋‹ค!

์ฒ˜์Œ์— bitnami-kafka ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๋””ํ”Œ๋กœ์ด ํ•œ ํ›„์— ๋‚˜์˜ค๋Š” ๊ฐ€์ด๋“œ๋ฅผ ๋”ฐ๋ผ kubernetes์— kafka-client๋ผ๋Š” pod์„ ํ•˜๋‚˜ ๋” ๋””ํ”Œ๋กœ์ด ํ•ฉ๋‹ˆ๋‹ค. ์ด Pod์€ bitnami/kafka ์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•˜์ง€๋งŒ, --command sleep infinity ๋•Œ๋ฌธ์— Kafka ํด๋Ÿฌ์Šคํ„ฐ๋กœ ๋™์ž‘ํ•˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. (์ด ๊ณผ์ •์— ๊ท€์ฐฎ๋‹ค๋ฉด, ๊ทธ๋ƒฅ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ด๋ฃจ๋Š” ๋ธŒ๋กœ์ปค ์ค‘ ํ•˜๋‚˜๋ฅผ ์‚ฌ์šฉํ•˜์…”๋„ ๋ฌด๋ฐฉํ•ฉ๋‹ˆ๋‹ค ใ…‹ใ…‹)

$ kubectl run bitnami-kafka-client --restart='Never' --image docker.io/bitnami/kafka:3.9.0-debian-12-r4 --namespace kafka --command -- sleep infinity

๊ฐ€์ด๋“œ์— ๋”ฐ๋ผ client.properties๋ผ๋Š” ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ์•„๋ž˜์™€ ๊ฐ™์ด ์ฑ„์›๋‹ˆ๋‹ค.

security.protocol=SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-256
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
    username="user1" \
    password="PASSWORD";

PASSWORD ๊ฐ’์€ kubectl get secret bitnami-kafka-user-passwords --namespace kafka -o jsonpath='{.data.client-passwords}' | base64 -d ๋ช…๋ น์–ด๋กœ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

์ƒ์„ฑํ•œ client.properties ํŒŒ์ผ์„ kafka-client Pod ์•ˆ์— ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.

$ kubectl cp --namespace kafka ./client.properties bitnami-kafka-client:/tmp/client.properties

๊ทธ๋ฆฌ๊ณ  ์•„๋ž˜ ๋ช…๋ น์–ด๋กœ Kafka ํด๋Ÿฌ์Šคํ„ฐ์— ์ ‘์†ํ•ด๋ด…์‹œ๋‹ค!

$ kubectl exec -it bitnami-kafka-client --namespace kafka -- sh

์ด์ œ ์•„๋ž˜ ๊ณผ์ •์„ ๋”ฐ๋ผํ•˜๋ฉฐ ์‹ค์Šต ํ•ด๋ด…์‹œ๋‹ค!

Topic CRUD

์•„๋ž˜ ๋ช…๋ น์–ด๋กœ ํ† ํ”ฝ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

$ kafka-topics.sh \
  --bootstrap-server bitnami-kafka.kafka.svc.cluster.local:9092 \
  --command-config /tmp/client.properties \
  --create \
  --replication-factor 1 \
  --partitions 2 \
  --topic test-topic
Created topic test-topic.

๋ณดํ†ต replication.factor=3 ์ •๋„๋กœ ์„ค์ •ํ•˜์ง€๋งŒ, ์ง€๊ธˆ ๋„์šด Kafka ํด๋Ÿฌ์Šคํ„ฐ์—๋Š” ๋ธŒ๋กœ์ปค๊ฐ€ ํ•˜๋‚˜ ๋ฟ์ด๊ธฐ ๋•Œ๋ฌธ์— replication.factor=1๋งŒ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  --list๋กœ ํ™•์ธํ•ด๋ณด๋ฉด

$ kafka-topics.sh \
  --bootstrap-server bitnami-kafka.kafka.svc.cluster.local:9092 \
  --command-config /tmp/client.properties \
  --list
test-topic

๋ฐฉ๊ธˆ ์ƒ์„ฑํ•œ ํ† ํ”ฝ์ด ์ž˜ ์ถœ๋ ฅ ๋ฉ๋‹ˆ๋‹ค ใ…Žใ…Ž

ํ† ํ”ฝ ์‚ญ์ œ๋Š” ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋กœ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

$ kafka-topics.sh \
  --bootstrap-server bitnami-kafka.kafka.svc.cluster.local:9092 \
  --command-config /tmp/client.properties \
  --delete \
  --topic test-topic

๋‹ค์‹œ --list๋กœ ํ™•์ธํ•ด๋ณด๋ฉด, ํ† ํ”ฝ์ด ์ถœ๋ ฅ์—์„œ ์‚ฌ๋ผ์ ธ ์žˆ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

Console Producer/Consumer

๋‹ค์‹œ --create๋กœ test-topic์„ ๋งŒ๋“ค์–ด์ค๋‹ˆ๋‹ค.

$ kafka-topics.sh \
  --bootstrap-server bitnami-kafka.kafka.svc.cluster.local:9092 \
  --command-config /tmp/client.properties \
  --create \
  --replication-factor 1 \
  --partitions 2 \
  --topic test-topic
Created topic test-topic.

kafka-console-producer.sh๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, ์ฝ˜์†” ์ž…๋ ฅ์œผ๋กœ Topic์— ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

$ kafka-console-producer.sh \
  --bootstrap-server bitnami-kafka.kafka.svc.cluster.local:9092 \
  --producer.config /tmp/client.properties \
  --topic test-topic
>hahaha
>hhohohoh
>merong

์•ž์—์„œ ๋””ํ”Œ๋กœ์ดํ•œ Kafka UI์—์„œ ํ•ด๋‹น ํ† ํ”ฝ์— ๋ฐ์ดํ„ฐ๊ฐ€ ์ž˜ ๋“ค์–ด๊ฐ€๋Š”์ง€ ํ™•์ธ ํ•ด๋ณผ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

Kafka UI์—์„œ ํ™•์ธํ•œ ๋ชจ์Šต

์ด๋ฒˆ์—๋Š” kafka-console-consumer.sh๋กœ ํ•ด๋‹น ํ† ํ”ฝ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ˜์†”์— ์ถœ๋ ฅํ•˜๋„๋ก Subscribe ํ•ด๋ด…์‹œ๋‹ค. ๐Ÿ‘“

$ kafka-console-consumer.sh \
  --consumer.config=/tmp/client.properties \
  --bootstrap-server bitnami-kafka.kafka.svc.cluster.local:9092 \
  --from-beginning \
  --topic=test-topic
hahaha
hhohohoh
merong

Deploy without Auth

๊ทธํ›„์— ๋กœ์ปฌ์—์„œ Kafka ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๋””ํ”Œ๋กœ์ด ํ•ด ์—ฐ์Šต์„ ํ•ด๋ณด๋‹ˆ, ๋กœ์ปฌ Kafka ํด๋Ÿฌ์Šคํ„ฐ์—์„  SASL Auth ์—†์ด ์ ‘์†ํ•˜๋Š”๊ฒŒ Kafka๋ฅผ ์ตํžˆ๋Š”๋ฐ ๋” ๋„์›€์ด ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹คโ€ฆ ๊ทธ๋ž˜์„œ bitnami-kafka๋ฅผ ๋””ํ”Œ๋กœ์ด ํ•  ๋•Œ ์‚ฌ์šฉํ•œ values.bitnami-kafka.yaml ํŒŒ์ผ์— listerners ๋ถ€๋ถ„์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

# @values.bitnami-kafka.yaml
zookeeper:
  enabled: true
  replicaCount: 1

broker:
  replicaCount: 3

controller:
  replicaCount: 0

kraft:
  enabled: false

listeners:
  client:
    protocol: 'PLAINTEXT'
  controller:
    protocol: 'PLAINTEXT'

๊ทธ๋ฆฌ๊ณ  ๋””ํ”Œ๋กœ์ด ํ•˜๋ฉด, SASL ์ธ์ฆ ์—†์ด๋„ Kafka ํด๋Ÿฌ์Šคํ„ฐ์— ์ ‘์†ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

๋” ๋‚˜์•„๊ฐ€๊ธฐ

์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” bitnami์˜ helm chart๋ฅผ ์‚ฌ์šฉํ•ด Kafka ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ Kubernetes์—์„œ ๊ตฌ์ถ• ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค! ๋ฌผ๋ก  ์ €๋Š” Confluent ํ”Œ๋žซํผ์—์„œ Kafka๋ฅผ ์“ฐ๊ธฐ ๋•Œ๋ฌธ์— ์š”๊ฑธ ์—…๋ฌด์—์„œ ํ•ด๋ณผ ๊ธฐํš๋Š” ์—†๊ฒ ์ง€๋งŒ! ์—ญ์‹œ ์‹ค์Šต์—์„œ ๋‹ค์–‘ํ•œ ์ •๋ณด์™€ ๋…ธํ•˜์šฐ๋“ค์ด ์ƒ๊ฒจ๋‚˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

์•„๋ž˜๋Š” ์ด๋ฒˆ ํฌ์ŠคํŠธ ์ดํ›„์— ์ง„ํ–‰ํ•ด๋ณด๋ ค๊ณ  ํ•˜๋Š” ๊ฒƒ๋“ค ์ž…๋‹ˆ๋‹ค!

  • Strimzi์˜ Strimzi Operator ๋ฐฉ์‹์œผ๋กœ Kafka on K8s ๊ตฌํ˜„ํ•˜๊ธฐ
    • Kafka ์ชฝ์—์„œ๋Š” ์š” Strimzi์˜ ๋„์›€์„ ๋ฐ›์•„ ๋””ํ”Œ๋กœ์ด ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์ด ๋ณด์˜€์Šต๋‹ˆ๋‹ค.
    • ์ด๋ฒˆ ๊ธฐํšŒ์— ํ•œ๋ฒˆ ์จ๋ณด๋ฉด ์žฌ๋ฐŒ์„ ๊ฒƒ ๊ฐ™๋„ค์š” ใ…Žใ…Ž
  • KRaft ๋ชจ๋“œ
    • ์ด๋ฒˆ์—๋Š” Zookeeper ๋ชจ๋“œ๋กœ Kafka ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ๋””ํ”Œ๋กœ์ด ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
    • Zookeeper๋ฅผ ์“ฐ์ง€ ์•Š๊ณ  Kafka ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์šด์˜ํ•˜๋Š” KRaft ๋ชจ๋“œ๋„ ํ•œ๋ฒˆ ์‹ค์Šต ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž
  • Kafka UI Deep Dive
    • ์š” ํฌ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜๋ฉด์„œ, Kafka UI๋ฅผ ์ฒ˜์Œ ์‚ฌ์šฉํ•ด๋ณด์•˜๋Š”๋ฐ์š”!
    • ์ด๊ฒƒ์ €๊ฒƒ ๋งŒ์ ธ๋ณด๋ฉด์„œ Kafka ํด๋Ÿฌ์Šคํ„ฐ ์šด์˜์— ๋Œ€ํ•œ ๊ฐ์„ ์ข€ ์žก์•„๋ณด๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค ใ…Žใ…Ž

์ €๋Š” ์ €๋ฒˆ์ฃผ์— Aํ˜• ๋…๊ฐ์— ๊ฑธ๋ฆฌ๊ณ  ๋ง์•˜๋Š”๋ฐ์š”! ๐Ÿค’ ์š”์–‘ํ•œ๋‹ค๊ณ  ๋ฐ–์— ์•ˆ ๋‚˜๊ฐ€์„œ ๊ทธ๋Ÿฐ์ง€ ์˜ค๋žซ๋™์•ˆ ๋ฌตํ˜€ ๋’€๋˜ ์š” ๊ธ€์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค ใ…‹ใ…‹ 2025๋…„ ์˜ฌ ํ•œํ•ด๋„ ์žฌ๋ฐŒ๋Š” ๊ฒƒ๋“ค ๋งŽ์ดํ•˜๊ณ , ๊ฑด๊ฐ•ํ•œ ํ•œ ํ•ด๊ฐ€ ๋  ์ˆ˜ ์žˆ๊ธธ! ๐Ÿ™

Categories:

Updated: