Holiday Project Part 3

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

By Chris Phillips on January 3, 2019.

Canonical link

Exported from Medium on April 6, 2019.