Search code examples
kubernetescqlcqlsh

How to execute a .cql file inside a kubernetes pod?


I need to execute a .cql file inside a kubernetes pod.

I did not try anything


Solution

  • To execute the .cql file inside a pod:

    1>copy the file to a pod:

    kubectl cp /path/of/the/file/.cql/ -n keyspace-name pod-name:/file/path/inside/the/pod -c name-of-container
    

    2>ssh to cassandra pod:

    kubectl exec -it pod-name -n keyspace-name -- bash
    

    3>run the .cql file:

    cqlsh -f/file/path/inside/the/pod