Kubernetes Action Runner


I’ve created a Python module leveraging the Asyncio Kubernetes Client to automate Kubernetes tasks triggered by GitHub Actions. It’s designed to run within a self-hosted GitHub runner managed by Actions Runner Controller (ARC) inside your Kubernetes cluster. The need for this originated from a previous role where we had to create a resource that ran inside our clusters to simulate app performance as part of our CICD pipelines. At the time, I could not find a suitable off-the-shelf solution that met our requirements, so I decided to build one myself. The module is designed to be flexible and can be easily extended to support additional Kubernetes resources.

The code has been sanitized (as it originally was monitoring an org specific CR) and published it to GitHub. You can find the raw code and instructions on how to use it there, and I provided a MIT license so you can freely use, modify, distribute as needed. I’ve included a working example where it creates two deployments, a “Mock Environment” which sets up and then runs the “Mock Application”, monitoring for a completion state, and then cleaning up the task. It is designed to work with GitHub Actions and Self-Hosted runners, which I recommend having ARC setup, but I provide ample instructions on running this locally as well.

I may come back and write more detailed instructions on how to use this, thoughts on the implementation, and a broader breakdown of setting this up from scratch, but for now, I wanted to get this out there for anyone who may need it. I hope this helps someone out there, and if you have any questions or need help, feel free to reach out to me via GitHub.