Roadsweeper — Kubernetes Job Cleaner — Holiday Project Part 3

Chris Phillips
1 min readJan 3, 2019

--

During my two weeks off of work I set myself the challenge to move as much of my home network infrastructure to Kubernetes as possible. My wife has often questioned “Why do you need any network Infrastructure, other then a wifi point?”. This article is still not going to address that question.

One of my projects over xmas was to build my own build engine, im not happy with it to publish it (yet) but one of the problems it did highlight was that cronjobs did not nicely clean up completed jobs.

I created ROADSWEEPER to clean up completed pods and their jobs. This itself is also a cronjob that runs every five minutes by default.

Written in nodejs with the kubernetes-client module, every five minutes it runs a job that polls list of pods in the desired namespace and if one is in the succeeded phase it deletes the pod and the corresponding job.

The code is available here https://github.com/ChrisPhillips-cminion/roadsweeper

The docker container is published here https://hub.docker.com/r/cminion/roadsweeper

--

--

Chris Phillips

Pink Teddy gets sent to help his owner's Daddy. All opinions are of Chris Phillips, IBM Master Inventor, API SME, Governance SME for IBM Cloud Services