I have deployed a Java application as a pod in a Kubernetes environment, as well as Cassandra with a 3-node cluster. I am using Cassandra service FQDN to connect to Cassandra. Due to the Cassandra pod restart, all its IPs got changed, and Cassandra client/java is still connecting to older IPs. Below error:
Error while opening new channel (ConnectionInitException: [s0|connecting...] Protocol initialization request, step 1 (STARTUP {CQL_VERSION=3.0.0, DRIVER_NAME=Apache Cassandra Java Driver, DRIVER_VERSION=4.18.0, CLIENT_ID=c6ddf75c-3ffd-433a-b6ee}): failed to send request (java.nio.channels.NotYetConnectedException))
How can I make java application(Using Java 17) connect to latest IPs though we connect through service FQDN?
Java version: 17, cassandra driver version: 4.18