Developing Minikube Github Actions to run Kubernetes
I have been discovering and experimenting with Kubernetes right after I passed my AWS Certified Solutions Architect Associate exam. So far, I wrote and deployed simple applications on my local Kubernetes cluster powered by Docker for Mac. I also deployed apps on Google Cloud. More recently I started getting interested in deploying Kubernetes apps using CI for free.
I also joined in Github Actions’ beta and attempted deploying my experimental apps there. I found only a single action offering to set up a Kubernetes cluster, it seemed to work but not quite. As in I could not spin up the cluster due to various errors. That action would install Minikube so in that regards it did exactly what it promised.
As a Docker for Mac user when it comes to running Kubernetes on my machine, I had to research Minikube. That way I could potentially come up with a way to run it within Github Actions. After a fair amount of attempts sporadically spread over a couple of weeks I dropped it. It felt like I was very close and yet so far but, as often, life got busy so that was it for now.
Fast-forward a few weeks, leading us to today’s lunch break. I realised one of the attempts I made did work. Yet the build failed because I forgot the step to build the app Docker image. I reproduced the setup and fixed the issue. I pushed my workflow config for Github Actions to do its thing. After a few minutes, my cluster was up and running! While I was about to write a post to tell you how to do that something hit me. I could just make it a publicly available action and share it with you. An action with the full power of open-source behind it. So I created an action now available on the Github marketplace.
That was all jolly but an issue arose when I realised that for some continuous integration to take place I would need to run tests. To run integration tests, I would need a way to know the apps are up and running before the testing can begin. Kubernetes apps don’t exactly start in a microsecond. So I wrote a second action that allows for waiting for applications to be up and running so that I can call its endpoints.