<p>I want to migrate 3 instances of Schema Registry from VMs (with Kafka leader election - not zookeeper) to docker containers running in kubernetes with zero downtime.</p>
<ol>
<li>Is there any way to check which instances are part of the schema-registry cluster ?</li>
<li>Should I expose the k8s instances as services + ingress for each pod ?</li>
<li>How to expose schema registry so it can be reachable from outside k8s ?</li>
<li>Should I move kafka first into k8s ?</li>
</ol>
<p>the problem is that kafka can't reach the k8s network/nodes</p>
<pre><code>[2023-01-20 13:33:34,778] ERROR Failed to send HTTP request to endpoint: http://10.100.102.139:18081/subjects/Alarm/versions (io.confluent.kafka.schemaregistry.client.rest.RestService)
java.net.SocketTimeoutException: connect timed out
</code></pre>
<ol start="5">
<li>what env variable to use in order to expose a DNS instead of IP (10.100.102.139), do I need one DNS for each instance ?</li>
</ol>

ady8531
<blockquote>
<p>which instances are part of the schema-registry cluster</p>
</blockquote>
<p>You would compare <code>kafkastore.bootstrap.servers</code> + <code>kafkastore.topic</code> + <code>schema.registry.group.id</code> properties of each instance <code>schema-registry.properties</code> (or env-vars for Docker container). If they match, they are the same Registry cluster. The latter two have default values, so may not be set.</p>
<blockquote>
<p>expose the k8s instances as services + ingress for each pod</p>
</blockquote>
<p>Depends where you need to access the Registry from. If you don't need external-cluster access, then you don't need an Ingress.</p>
<blockquote>
<p>expose schema registry so it can be reachable from outside k8s</p>
</blockquote>
<p>See above. That's what an Ingress does, in combination with a <code>LoadBalancer</code> or <code>ClusterIP</code> + <code>NodePort</code> configuration spec.</p>
<blockquote>
<p>move kafka first into k8s ?</p>
</blockquote>
<p>Up to you. That's not a requirement for running the Registry.</p>
<blockquote>
<p>kafka can't reach the k8s network/nodes</p>
</blockquote>
<p>The broker doesn't need to communicate with the Registry, only the <em>clients</em> do.</p>
<blockquote>
<p>what env variable to use in order to expose a DNS</p>
</blockquote>
<p>You wouldn't. Your <code>IngressController</code> would be configured to a DNS server, such as ALB IngressController + ExternalDNS w/ AWS. Then you provide that FQDN as <code>schema.registry.url</code> in your apps.</p>
<p>I suggest trying a simpler HTTP server first.</p>
<blockquote>
<p>do I need one DNS for each instance ?</p>
</blockquote>
<p>Kubernetes does that internally for the pods, but your external DNS address would only be for the Ingress pod. E.g. for nginx IngressController, the DNS entry would point direct traffic at an nginx pod, running a reverse proxy to the other pods.</p>
