K8ssandra Forum

HOW TO: Access Cassandra & Create Cassandra Users

To get the cassanrda super user credentials for your basic demo cluster execute the following commands:

kubectl get secret k8ssandra-superuser -o jsonpath="{.data.username}" | base64 --decode ; echo
kubectl get secret k8ssandra-superuser -o jsonpath="{.data.password}" | base64 --decode ; echo

To access cassandra cqlsh exec on a cassandra pod:

kubectl exec -it k8ssandra-dc1-default-sts-0 /bin/bash

cassandra@k8ssandra-dc1-default-sts-0:/$ cqlsh localhost 9042 -u k8ssandra-superuser -p OydXi6iO4MEUUqODGAC3

Some examples to create additional roles other than super user, from cqlsh:

CREATE ROLE new_role;
CREATE ROLE alice WITH PASSWORD = 'password_a' AND LOGIN = true;
CREATE ROLE bob WITH PASSWORD = 'password_b' AND LOGIN = true AND SUPERUSER = true;
CREATE ROLE carlos WITH OPTIONS = { 'custom_option1' : 'option1_value', 'custom_option2' : 99 };
CREATE ROLE alice WITH PASSWORD = 'password_a' AND LOGIN = true AND ACCESS TO DATACENTERS {'DC1', 'DC3'};
CREATE ROLE alice WITH PASSWORD = 'password_a' AND LOGIN = true AND ACCESS TO ALL DATACENTERS;

reference: Documentation

1 Like