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.
- Is there any way to check which instances are part of the schema-registry cluster ?
- Should I expose the k8s instances as services ingress for each pod ?
- How to expose schema registry so it can be reachable from outside k8s ?
- Should I move kafka first into k8s ?
the problem is that kafka can't reach the k8s network/nodes
[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
- 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 ?
CodePudding user response:
which instances are part of the schema-registry cluster
You would compare kafkastore.bootstrap.servers
kafkastore.topic
schema.registry.group.id
properties of each instance schema-registry.properties
(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.
expose the k8s instances as services ingress for each pod
Depends where you need to access the Registry from. If you don't need external-cluster access, then you don't need an Ingress.
expose schema registry so it can be reachable from outside k8s
See above. That's what an Ingress does, in combination with a LoadBalancer
or ClusterIP
NodePort
configuration spec.
move kafka first into k8s ?
Up to you. That's not a requirement for running the Registry.
kafka can't reach the k8s network/nodes
The broker doesn't need to communicate with the Registry, only the clients do.
what env variable to use in order to expose a DNS
You wouldn't. Your IngressController
would be configured to a DNS server, such as ALB IngressController ExternalDNS w/ AWS. Then you provide that FQDN as schema.registry.url
in your apps.
I suggest trying a simpler HTTP server first.
do I need one DNS for each instance ?
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.