Open aliakhtar opened 7 years ago
after some digging around i believe this has to do with kubernetes writing an env var KAFKA_... and then getting overwritten in the config file with the following code in start-kafka.sh. i would try renaming things other than kafka.
for VAR in `env`
do
if [[ $VAR =~ ^KAFKA_ && ! $VAR =~ ^KAFKA_HOME ]]; then
kafka_name=`echo "$VAR" | sed -r "s/KAFKA_(.*)=.*/\1/g" | tr '[:upper:]' '[:lower:]' | tr _ .`
env_var=`echo "$VAR" | sed -r "s/(.*)=.*/\1/g"`
if egrep -q "(^|^#)$kafka_name=" $KAFKA_HOME/config/server.properties; then
sed -r -i "s@(^|^#)($kafka_name)=(.*)@\2=${!env_var}@g" $KAFKA_HOME/config/server.properties #note that no config values may contain an '@' char
else
echo "$kafka_name=${!env_var}" >> $KAFKA_HOME/config/server.properties
fi
fi
done
Seems that if you have service called kafka, kubernetes creates environment variable called KAFKA_PORT="tcp://x.x.x.x:9092"
Yes, when I changed a name of service from 'kafka' to 'kafka-cluster' it stopped crashing.
I added in my docker-compose file (i'm using kompose up to deploy my cluster). And it looks like solved the issue. environment: KAFKA_PORT: 9092
Or in *-deployment.yaml try to add:
- name: KAFKA_PORT
value: "9092"
I hit this issue too. In Openshift that uses kubernetes. My openshift service was renamed to kafkaa and it solved the problem.
Same here. Had to rename kubernetes service from kafka
to something else.
You can use unset KAFKA_PORT
as per the detail listed here https://github.com/confluentinc/cp-docker-images/issues/388 then you wont have the issue (and wont need to rename the service)
Unfortunately, until start scripts stop failure on the setting on KAFKA_PORT
and/or kafka startup stops recognising this as an ENVVAR it should use at startup, workaround will have to remain in place
add this to environment in docker-compose .yml KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
can anyone please share the docker-compose for kafka?
Even after renaming to kafka-cluster
or kafkaa
and then running on kubernetes, I am getting the same error shared above.
org.apache.kafka.common.config.ConfigException: Invalid value tcp://10.106.136.1:9092 for configuration port: Not a number of type INT
@spicysomtam
never mind, I solved it by adding KAFKA_PORT env variable
是的,当我将服务名称从“ kafka”更改为“ kafka-cluster”时,它不再崩溃。
great
for eks.yaml files that env var can't be INT, but worked by setting the
Seems that if you have service called kafka, kubernetes creates environment variable called KAFKA_PORT="tcp://x.x.x.x:9092"
This is fix for me too.
I'm following http://www.defuze.org/archives/351-running-a-zookeeper-and-kafka-cluster-with-kubernetes-on-aws.html in order to deploy Kafka on Kubernetes.
This is what my configuration looks like:
The hostname
kafka
is resolved internally to the IP of the kafka service, which in this case is10.0.35.234
.When I run this, the container crashes. These are the logs I see:
After this, it fails while creating the topic because replication factor = 1 and brokers = 0.
Why is it using
tcp://10.0.35.234:9092
as the value of the port?