I have k8s cluster with Istio v1.6.4. The sidecar injection is disabled by default. I have Kafka cluster running on this k8s installed with strimzi kafka operator. The Kafka cluster works without any problems when kafka as well as client pods doesn't have Istio-proxy injected. My problem: When I create a pod with kafka client and Istio-proxy injected I can't connect to Kafka cluster. The logs on client side:
java.io.IOException: Connection reset by peer
and on the server side:
org.apache.kafka.common.network.InvalidReceiveException: Invalid receive (size = 369295616 larger than 104857600)
After some googling and checking the Istio-proxy logs it turns out the problem is that Istio-proxy connects to kafka plaintext endpoint with TLS.
I can workaround this by setting the default PeerAuthentication with mtls.mode: DISABLED
but I don't want to set global setting for it.
What is strange if I create a simple k8s service and run the netcat "server" on pod running kafka server and netcat "client" on pod running kafka client - everything works fine.
I have 2 question:
- Why the kafka Istio-proxy behaves different when connecting to Kafka cluster than other TCP connections (like using nc)?
- How to disable mtls for one host only? I was playing with PeerAuthentication but no luck...
trafficPolicy: tls: mode: SIMPLE
for this one host. Take a look at documentation here. let me know if this solves the problem. – Jakubspec.mtls.mode: DISABLE
. – gkocurkafka-bootstrap
which is a regular service (with IP) andkafka-brokers
which is headless service. I was using thebootstrap
and switching tobrokers
(together with DestinationRule) solved this issue. Thank you! Will write a detailed answer. – gkocur