banzaicloud/koperator

./kafka-acls.sh cannot be used in broker POD

jxjpds opened this issue · 4 comments

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.(Unknown Source)
at jdk.httpserver/sun.net.httpserver.HttpServerImpl.(Unknown Source)
at jdk.httpserver/sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(Unknown Source)
at jdk.httpserver/com.sun.net.httpserver.HttpServer.create(Unknown Source)
at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer.(HTTPServer.java:190)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:31)
... 6 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at ../src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
'''

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