Difference between revisions of "Kafka k8s"

From UVOO Tech Wiki
Jump to navigation Jump to search
(Created page with "https://github.com/bitnami/charts/tree/master/bitnami/kafka ``` helm repo add bitnami https://charts.bitnami.com/bitnami helm install my-test bitnami/kafka ``` # Zookeper P...")
 
 
(3 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
# Zookeper Permission denied error
 
# Zookeper Permission denied error
 +
 +
You may get this in some of your setups. No what you are doing or not doing when you do this
 +
```
 +
zookeeper 15:26:12.81 INFO  ==> ** Starting ZooKeeper setup **
 +
zookeeper 15:26:12.83 WARN  ==> You have set the environment variable ALLOW_ANONYMOUS_LOGIN=yes. For safety reasons, do not use this flag in a production environment.
 +
mkdir: cannot create directory '/bitnami/zookeeper/data': Permission denied
 +
```
 +
 
- https://techoverflow.net/2020/01/28/how-to-fix-bitnami-mariadb-mkdir-cannot-create-directory-bitnami-mariadb-permission-denied/
 
- https://techoverflow.net/2020/01/28/how-to-fix-bitnami-mariadb-mkdir-cannot-create-directory-bitnami-mariadb-permission-denied/
  
Line 18: Line 26:
 
```
 
```
 
chmod 777 will do it be we don't want that.
 
chmod 777 will do it be we don't want that.
 +
 +
```
 +
I have no name!@mytest-zookeeper-0:/opt/bitnami/zookeeper$ ls -lhat /bitnami/zookeeper/data/
 +
total 16K
 +
drwxr-xr-x 2 1001 root 4.0K Mar 11 15:38 version-2
 +
drwxr-xr-x 3 1001 root 4.0K Mar 11 15:36 .
 +
-rw-r--r-- 1 1001 root    2 Mar 11 15:36 myid
 +
drwxrwxrwx 3 root root 4.0K Mar 11 15:36 ..
 +
I have no name!@mytest-zookeeper-0:/opt/bitnami/zookeeper$
 +
```
 +
 +
Produce & Consume
 +
```
 +
kubectl run mytest-kafka-client --restart='Never' --image docker.io/bitnami/kafka:3.1.0-debian-10-r40 --namespace test --command -- sleep infinity
 +
kubectl exec --tty -i mytest-kafka-client --namespace test -- bash
 +
kafka-console-producer.sh --broker-list busktest-kafka-0.mytest-kafka-headless.test.svc.cluster.local:9092 --topic test
 +
<type foo fi fum>
 +
kafka-console-consumer.sh --bootstrap-server mytest-kafka.test.svc.cluster.local:9092 --topic test --from-beginning
 +
```

Latest revision as of 16:09, 11 March 2022

https://github.com/bitnami/charts/tree/master/bitnami/kafka

helm repo add bitnami https://charts.bitnami.com/bitnami
helm install my-test bitnami/kafka

Zookeper Permission denied error

You may get this in some of your setups. No what you are doing or not doing when you do this

zookeeper 15:26:12.81 INFO  ==> ** Starting ZooKeeper setup **
zookeeper 15:26:12.83 WARN  ==> You have set the environment variable ALLOW_ANONYMOUS_LOGIN=yes. For safety reasons, do not use this flag in a production environment.
mkdir: cannot create directory '/bitnami/zookeeper/data': Permission denied
locate pvc-e39c70fb-130d-476d-a6b0-7e7ff205d5a5
sudo chown -R 1001:1001 /var/snap/microk8s/common/default-storage/test-data-mytest-zookeeper-0-pvc-e39c70fb-130d-476d-a6b0-7e7ff205d5a5

chmod 777 will do it be we don't want that.

I have no name!@mytest-zookeeper-0:/opt/bitnami/zookeeper$ ls -lhat /bitnami/zookeeper/data/
total 16K
drwxr-xr-x 2 1001 root 4.0K Mar 11 15:38 version-2
drwxr-xr-x 3 1001 root 4.0K Mar 11 15:36 .
-rw-r--r-- 1 1001 root    2 Mar 11 15:36 myid
drwxrwxrwx 3 root root 4.0K Mar 11 15:36 ..
I have no name!@mytest-zookeeper-0:/opt/bitnami/zookeeper$

Produce & Consume

kubectl run mytest-kafka-client --restart='Never' --image docker.io/bitnami/kafka:3.1.0-debian-10-r40 --namespace test --command -- sleep infinity
kubectl exec --tty -i mytest-kafka-client --namespace test -- bash
kafka-console-producer.sh --broker-list busktest-kafka-0.mytest-kafka-headless.test.svc.cluster.local:9092 --topic test
<type foo fi fum>
kafka-console-consumer.sh --bootstrap-server mytest-kafka.test.svc.cluster.local:9092 --topic test --from-beginning