natrajan.rajasekaran_191958 avatar image
natrajan.rajasekaran_191958 asked Erick Ramirez answered

Why am I getting "nodetool: Failed to connect to ''" when connecting to my k8s cluster in the week 5 exercise?


I worked on the exercises for Cassandra on Kubernetes exercises at

I tried do it in the cloud environment provided by datastax as well as on my laptop.

With laptop: I went up to step 4d successfully. When i tried 'nodetool status', I got

'nodetool: Failed to connect to '' - ConnectException: 'Connection refused (Connection refused)'.

I tried the 'cqlsh cluster1-dc1-service.cass-operator -u cluster1-superuser -p <mypassword>', I got the below:

Traceback (most recent call last):
File "/opt/cassandra/bin/", line 2443, in <module>
main(*read_options(sys.argv[1:], os.environ))
File "/opt/cassandra/bin/", line 2421, in main
File "/opt/cassandra/bin/", line 485, in __init__
File "/opt/cassandra/bin/../lib/", line 417, in __init__
socket.gaierror: [Errno -2] Name or service not known.

Please provide me with the steps to reset the enviornment.

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

You've provided limited information about your k8s cluster but my guess is that the pods are not fully operational (failed to start successfully).

You can check the status of your pods by running the following command:

$ kubectl -n cass-operator get pods

Here is an example output for a 3-pod cluster:

$ kubectl -n cass-operator get pods
NAME                             READY   STATUS    RESTARTS   AGE
cass-operator-56fcb9ff47-kb9lf   1/1     Running   0          6d15h
cluster1-dc1-default-sts-0       2/2     Running   0          6d15h
cluster1-dc1-default-sts-1       2/2     Running   0          6d15h
cluster1-dc1-default-sts-2       2/2     Running   0          6d15h

Note that if the value in the READY column is set to 1/2, it means that the Cassandra instance in that pod has not started successfully (for whatever reason).

If the C* instances have not started in the pod or if you ran into issues installing the cass-operator, you will not be able to connect to the Cassandra cluster via cqlsh.

If you want to start over, you can delete your KiND cluster with the following command:

$ kind delete cluster --name kind-cassandra

For more info on deleting a KiND cluster or other basic Kubernetes commands, see the KiND Quick Start guide. Cheers!

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.