question

sandy.davis_63587 avatar image
sandy.davis_63587 asked Erick Ramirez answered

Connecting via cqlsh in a k8s pod returns "Name or service not known"

Getting error trying to startup cqlsh. Below are the steps taken,

Sandy-iMac-2: kubectl -n cass-operator get cassandradatacenter
NAME AGE
dc1 10m
Sandy-iMac-2: kubectl -n cass-operator get sts
NAME READY AGE
cluster1-dc1-default-sts 0/1 10m
Sandy@Davis-iMac-2: kubectl -n cass-operator get secret cluster1-superuser -o yaml
apiVersion: v1
data:
password: R3BKbGhoZzZWWE01X3RKNDh0TGRJeS1aUWhybGo3bVpKZExqMERmdDNyb2VXRWZVSldYWDNB
username: Y2x1c3RlcjEtc3VwZXJ1c2Vy
kind: Secret
metadata:
creationTimestamp: "2020-08-17T02:21:41Z"
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:data:
.: {}
f:password: {}
f:username: {}
f:type: {}
manager: operator
operation: Update
time: "2020-08-17T02:21:41Z"
name: cluster1-superuser
namespace: cass-operator
resourceVersion: "4558"
selfLink: /api/v1/namespaces/cass-operator/secrets/cluster1-superuser
uid: 28eec179-f182-4638-aa8b-cd697ad6e806
type: Opaque
Sandy-iMac-2: echo R3BKbGhoZzZWWE01X3RKNDh0TGRJeS1aUWhybGo3bVpKZExqMERmdDNyb2VXRWZVSldYWDNB | base64 -d && echo ""
GpJlhhg6VXM5_tJ48tLdIy-ZQhrlj7mZJdLj0Dft3roeWEfUJWXX3A
Sandy-iMac-2: kubectl -n cass-operator exec -it cluster1-dc1-default-sts-0 -- /bin/bash
Defaulting container name to cassandra.
Use 'kubectl describe pod/cluster1-dc1-default-sts-0 -n cass-operator' to see all of the containers in this pod.
root@cluster1-dc1-default-sts-0:/# cqlsh cluster1-dc1-service.cass-operator -u cluster1-superuser -p GpJlhhg6VXM5_tJ48tLdIy-ZQhrlj7mZJdLj0Dft3roeWEfUJWXX3A
Traceback (most recent call last):
File "/opt/cassandra/bin/cqlsh.py", line 2443, in <module>
main(*read_options(sys.argv[1:], os.environ))
File "/opt/cassandra/bin/cqlsh.py", line 2421, in main
encoding=options.encoding)
File "/opt/cassandra/bin/cqlsh.py", line 485, in __init__
load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]),
File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/policies.py", line 417, in __init__
socket.gaierror: [Errno -2] Name or service not known
workshop
1 comment
10 |1000

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

bettina.swynnerton avatar image bettina.swynnerton ♦♦ commented ·

apparently this was an error in our readme docs, which has now been corrected, thanks for pointing it out!

0 Likes 0 ·
bettina.swynnerton avatar image
bettina.swynnerton answered

Hi @sandy.davis_63587,

Once you are logged into your cassandra container, you start cqlsh by only specifying the username and password.

In your case this would look like this:

cqlsh -u cluster1-superuser -p GpJlhhg6VXM5_tJ48tLdIy-ZQhrlj7mZJdLj0Dft3roeWEfUJWXX3A

Try this and let us know how you get on.

Thanks!

Share
10 |1000

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

Erick Ramirez avatar image
Erick Ramirez answered

Sorry, this was a cut-and-paste mistake on our part. Thanks for bringing it to our attention.

I've logged issue #28 and pushed a fix to the GitHub repo. Cheers!

Share
10 |1000

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