Yolean / kubernetes-kafka

Kafka cluster as Kubernetes StatefulSet, plain manifests and config
Apache License 2.0
1.83k stars 738 forks source link

Error processing /etc/kafka/zookeeper.properties.scale-5.pzoo-1 #335

Open jaeyj2 opened 3 years ago

jaeyj2 commented 3 years ago

There is the same issue here, but it has been closed and has been reposted. I followed the guide, and I got to the Pod's starting state normally. However, the pod status fails.

NAME READY STATUS RESTARTS AGE kafka-0 0/1 CrashLoopBackOff 45 3h35m kafka-1 0/1 CrashLoopBackOff 45 3h35m kafka-2 0/1 CrashLoopBackOff 45 3h35m pzoo-0 0/1 CrashLoopBackOff 10 28m pzoo-1 0/1 CrashLoopBackOff 10 28m pzoo-2 0/1 CrashLoopBackOff 10 28m zoo-0 0/1 CrashLoopBackOff 10 28m zoo-1 0/1 CrashLoopBackOff 10 28m

The pod log. [root@pstest01 kafka2]# kubectl logs pzoo-1 -n kafka2 [2020-10-30 08:41:02,645] INFO Reading configuration from: /etc/kafka/zookeeper.properties.scale-5.pzoo-1 (org.apache.zookeeper.server.quorum.QuorumPeerConfig) [2020-10-30 08:41:02,647] ERROR Invalid config, exiting abnormally (org.apache.zookeeper.server.quorum.QuorumPeerMain) org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /etc/kafka/zookeeper.properties.scale-5.pzoo-1 at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:156) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:113) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:82) Caused by: java.lang.IllegalArgumentException: /etc/kafka/zookeeper.properties.scale-5.pzoo-1 file is missing at org.apache.zookeeper.server.util.VerifyingFileFactory.doFailForNonExistingPath(VerifyingFileFactory.java:51) at org.apache.zookeeper.server.util.VerifyingFileFactory.validate(VerifyingFileFactory.java:45) at org.apache.zookeeper.server.util.VerifyingFileFactory.create(VerifyingFileFactory.java:40) at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:141) ... 2 more

It seems that we need to modify the zookeeper.properties related part of configmap. But I don't know which of the many lines is the problem. Because the log only came out missing files.

zookeeper-config.yml was applied as it is.

jaeyj2 commented 3 years ago

/etc/kafka/zookeeper.properties.scale-5.pzoo-1 org.apache.zookeeper.server.util.VerifyingFileFactory.doFailForNonExistingPath

I don't know why zookeeper.properties is not getting this file from log.

uluzox commented 3 years ago

I am having the same issue

The logs of the init-config container of zoo-1 Pod are:

+ '[' '!' -d /var/lib/zookeeper/data ']'
+ '[' -z 4 ']'
+ export ZOOKEEPER_SERVER_ID=5
+ ZOOKEEPER_SERVER_ID=5
+ echo 5
+ tee /var/lib/zookeeper/data/myid
5
+ cp -Lur /etc/kafka-configmap/init.sh /etc/kafka-configmap/log4j.properties /etc/kafka-configmap/zookeeper.properties /etc/kafka/
+ '[' '!' -z '' ']'
+ ln -s /etc/kafka/zookeeper.properties /etc/kafka/zookeeper.properties.scale-.zoo-1

From 10zookeeper-config.yml $REPLICAS does not seem to be get set...

ln -s /etc/kafka/zookeeper.properties /etc/kafka/zookeeper.properties.scale-$REPLICAS.$POD_NAME

Im running on k3s and rancher

jaeyj2 commented 3 years ago

C:\Users\jae\Downloads\111\kafka_2.11-2.4.0\kafka_2.11-2.4.0\bin C:\Users\jae\Downloads\111\kafka_2.11-2.4.0\kafka_2.11-2.4.0\config

kafka2.4.1's directory is bin and config.
but this configmap targeting is /etc/kafka.

Maybe this need to fix real directory

What is the real path of the docker image's config and bin directory?

uluzox commented 3 years ago

Changing ln -s /etc/kafka/zookeeper.properties /etc/kafka/zookeeper.properties.scale-$REPLICAS.$POD_NAME to ln -s /etc/kafka/zookeeper.properties /etc/kafka/zookeeper.properties.scale-5.$POD_NAME in 10zookeeper-config.yml seems to have solved the issue... I did this because both 51zoo.yml and 50pzoo.yml run this command:

command:
        - ./bin/zookeeper-server-start.sh
        - /etc/kafka/zookeeper.properties.scale-5.$(POD_NAME)

However this is not a real solution, is it?

jaeyj2 commented 3 years ago

After zookeeper-config.yml modification, it was started normally. Thank you.