I have a cluster of 3 Cassandra pods running on Kubernetes. I want to do automatic backup of my data and for that I need to run nodetool snaphot command inside of each container and I need to invoke it remotely. What is the correct way to do it from architectural point of view? Do I need modify cassandra image to have ssh deamon in it or do I need to have helper containers in cassandra pods or to do this by 'kubectl exec' Kubernetes API calls? Other options?
I think k8s cronJob
resource - is what you need for backing up the data via nodetool
. Generally, the cronJob
has jobTemplate
section with spec
section within. The spec
section, in turn, has containers definition, almost the same as in the Deployment
. You can build your own docker image with nodetool
in it (or try to find somewhere on dockerhub) and run it with your own specific configuration.
More info: https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/