Reputation: 6459
We have a number of pods communicating with each other and storing state via either etc or shared PVs. Sometimes we get in a messed up state and we want to have a command that will blow away all our saved state and restart things fresh as a debug tool.
To do this we need to stop a number of containers, across many nodes. Once stopped we need to delete data in ETC and volumes, then once that's done restart the containers.
This seems pretty easy to do with a bash script, but my management doesn't want a bash script since we only deploy kubernetes configuration and he doesn't want a separate script to exist but not be deployed automatically with the rest of our codebase.
I'm wondering if I can use something similar to kubernetes jobs, or any other tool, to set up the same logic within kubernetes so it's deployed with the rest of our kubernetes code. Something where I can run a simple command and have my prewritten scripted logic run to completion? I had hoped a kubernetes job would work, but the job wouldn't have access to kubectl or any way of starting and stopping other pods or containers.
Is there a kubernetes functionality I missed to make it easier to pause multiple pods while our cleanup logic runs?
Upvotes: 0
Views: 51
Reputation: 1533
Ansible can be used for running commands in your nodes, you can use ansible playbooks instead of bash script or you can use this playbook to run your bash script. Similarly there are tools like rundeck and n8n if you prefer a webhook method of implementation. If you are planning to implement a CICD pipeline you can use tools like Jenkins.
Upvotes: 1