<p>I cannot access my Cassandra database, deployed on the same namespace in kubernetes.</p>

<p>My service has no cluster IP but an internal endpoint cassandra.hosting:9042 but whenever I try to connect from an internal spring application using </p>

<pre><code>spring.data.cassandra.contact-points=cassandra.hosting
</code></pre>

<p>it fails with the error <code>All host(s) tried for query failed</code></p>

<p>How did you configure your endpoint?  Generally, all services and pods in a Kubernetes cluster are discoverable through a standard <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">DNS notation</a>. It looks like this:</p>

<pre><code>&lt;service-name&gt;.&lt;namespace&gt;.svc.cluster.local # or
&lt;pod-name&gt;.&lt;namespace&gt;.svc.cluster.local # or
&lt;pod-name&gt;.&lt;subdomain&gt;.&lt;namespace&gt;.svc.cluster.local
</code></pre>

<p>If you are within the same namespace this would work too:</p>

<pre><code>&lt;service-name&gt;
&lt;pod-name&gt;
&lt;pod-name&gt;.&lt;subdomain&gt;
</code></pre>

<p>I would also check either <code>core-dns</code> or <code>kube-dns</code> are running and ready:</p>

<pre><code>kubectl -n kube-system get pods | grep dns
</code></pre>
