koperator
koperator copied to clipboard
./kafka-acls.sh cannot be used in broker POD
I have a question. Kafka commands cannot be used in Broker POD. Is this normal? ''' kubectl get pod -n kafka
test-pass-ssl-0-tj4hx 1/1 Running 0 18m
test-pass-ssl-1-qrrl9 1/1 Running 0 17m
test-pass-ssl-cruisecontrol-696bdd9846-8czmr 1/1 Running 0 9m4s
'''
'''
kubectl exec -it -n kafka test-pass-ssl-0-tj4hx bash
root@test-pass-ssl-0:/opt/kafka/bin# ./kafka-acls.sh
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at jdk.httpserver/sun.net.httpserver.ServerImpl.
None of the kafka tools can be run from within a broker pod as all these try to bind to a port which is already in use by Kafka. Run all these tools from a separate pod. (e.g. deploy a pod using ghcr.io/banzaicloud/kafka:2.13-3.1.0
image, than exec into that pod and run the kafka-acls.sh
tool from that pod).
You can also do:
$unset KAFKA_OPTS
$./kafka-acls.sh
You can also do:
$unset KAFKA_OPTS $./kafka-acls.sh
@jxjpds using the info provided by @bartam1 I was able to run the script, can you confirm it is also working on your end?
Closing this issue since there is no update from the reporter and it has been verified that the ./kafka-acls.sh
can be run within the broker pod