I am writing an automated test procedure that looks for certain pieces of data in a MongoDB instance inside a k8s cluster. I am reading-up on kubernetes but have very little experience in using it. The problem I have is the data does not exist in the db until I insert it. My goal is to automate the data insertion at the beginning of the test run followed by the removal of the data on test completion.
For now, I am manually inserting the json data by ssh'ing into the cluster, using kubectl to get the mongo pod name, performing "kubectl exec -it /bin/bash" to get into the mongo pod, followed by "mongoimport" to get the data in the db.
All that works fine but what a headache. Not to mention, this cluster is destroyed regularly meaning I have to redo the import and this doesn't help on the automation front. I've tried automating my above procedure but run into issues with the "exec" command (not to mention, I am sure this is not the proper approach).
I have no immediate control over the cluster. Any changes that affect the cluster would have to be pushed through to our over-worked development team which could take quite a while (but if that is what's needed, so be it).
Any thoughts on my approach would be greatly appreciated.
Thanks