<p>We are bringing up a Cassandra cluster, using k8ssandra helm chart, it exposes several services, our client applications are using the datastax Java-Driver and running at the same k8s cluster as the Cassandra cluster (this is testing phase)</p>
<pre><code>CqlSessionBuilder builder = CqlSession.builder();
</code></pre>
<p>What is the recommended way to connect the application (via the Driver) to Cassandra?</p>
<p>Adding all nodes?</p>
<pre><code>for (String node :nodes) {
   builder.addContactPoint(new InetSocketAddress(node, 9042));
}
</code></pre>
<p>Adding just the service address?</p>
<pre><code> builder.addContactPoint(new InetSocketAddress(service-dns-name , 9042))
</code></pre>
<p>Adding the service address as unresolved? (would that even work?)</p>
<pre><code> builder.addContactPoint(InetSocketAddress.createUnresolved(service-dns-name , 9042))
</code></pre>

Doron Levi
<p>The k8ssandra Helm chart deploys a CassandraDatacenter object and cass-operator in addition to a number of other resources. cass-operator is responsible for managing the CassandraDatacenter. It creates the StatefulSet(s) and creates several headless services including:</p>
<ul>
<li>datacenter service</li>
<li>seeds service</li>
<li>all pods service</li>
</ul>
<p>The seeds service only resolves to pods that are seeds. Its name is of the form <code>&lt;cluster-name&gt;-seed-service</code>. Because of the ephemeral nature of pods cass-operator may designate different C* nodes as seed nodes. Do not use the seed service for connecting client applications.</p>
<p>The all pods service resolves to all Cassandra pods, regardless of whether they are readiness. Its name is of the form <code>&lt;cluster-name&gt;-&lt;dc-name&gt;-all-pods-service</code>. This service is intended to facilitate with monitoring. Do not use the all pods service for connecting client applications.</p>
<p>The datacenter service resolves to ready pods. Its name is of the form <code>&lt;cluster-name&gt;-&lt;dc-name&gt;-service</code> This is the service that you should use for connecting client applications. Do not directly use pod IPs as they will change over time.</p>
