<p>PROBLEM:
For some reason client pod can only resolve fully qualified fully-qualified DNS names including the cluster service suffix.</p>
<p>That problem is stated in this quesion:
<a href="https://stackoverflow.com/questions/64578163/aks-windows-node-dns-does-not-resolve-service-until-fully-qualified-name-is-us">AKS, WIndows Node, dns does not resolve service until fully qualified name is used</a></p>
<p>To workaround this issue, I'm using useServiceDnsDomain flag. The documentation (<a href="https://strimzi.io/docs/operators/master/using.html#type-GenericKafkaListenerConfiguration-schema-reference" rel="nofollow noreferrer">https://strimzi.io/docs/operators/master/using.html#type-GenericKafkaListenerConfiguration-schema-reference</a> ) explains it as</p>
<blockquote>
<p>Configures whether the Kubernetes service DNS domain should be used or
not. If set to true, the generated addresses with contain the service
DNS domain suffix (by default .cluster.local, can be configured using
environment variable KUBERNETES_SERVICE_DNS_DOMAIN). Defaults to
false.This field can be used only with internal type listener.</p>
</blockquote>
<p>Part of my yaml is as follows</p>
<pre><code>apiVersion: kafka.strimzi.io/v1beta1
kind: Kafka
metadata:
  name: tt-kafka
  namespace: shared
spec:
  kafka:
    version: 2.5.0
    replicas: 3
    listeners:
      - name: local
        port: 9092
        type: internal
        tls: false
        useServiceDnsDomain: true
</code></pre>
<p>This didn't do anything, so I also tried adding KUBERNETES_SERVICE_DNS_DOMAIN like below</p>
<pre><code>template:
  kafkaContainer:
    env:
      - name: KUBERNETES_SERVICE_DNS_DOMAIN
        value: .cluster.local
</code></pre>
<p>strimzi/operator:0.20.0 image is being used.</p>
<p>In my client (.net Confluent.Kafka 1.4.4), I used tt-kafka-kafka-bootstrap.shared.svc.cluster.local as BootstrapServers.
It gives me error as</p>
<blockquote>
<p>Error: GroupCoordinator: Failed to resolve
'tt-kafka-kafka-2.tt-kafka-kafka-brokers.shared.svc:9092': No such
host is known.</p>
</blockquote>
<p>I'm expecting the broker service to provide full names to the client but from the error it seems  useServiceDnsDomain  has no effect.</p>
<p>Any help is appreciated. Thanks.</p>

<p>As exmaplained in <a href="https://github.com/strimzi/strimzi-kafka-operator/issues/3898" rel="nofollow noreferrer">https://github.com/strimzi/strimzi-kafka-operator/issues/3898</a>, there is a typo in the docs. The right YAML is:</p>
<pre class="lang-yaml prettyprint-override"><code>  listeners:
    - name: plain
      port: 9092
      type: internal
      tls: false
      configuration:
        useServiceDnsDomain: true
</code></pre>
<p>If your domain is different from <code>.cluster.local</code>, you can use the <code>KUBERNETES_SERVICE_DNS_DOMAIN</code> env var to override it. But you have to configure it on the Strimzi Cluster Operator pod. Not on the Kafka pods: <a href="https://strimzi.io/docs/operators/latest/full/using.html#ref-operator-cluster-str" rel="nofollow noreferrer">https://strimzi.io/docs/operators/latest/full/using.html#ref-operator-cluster-str</a></p>
