Deploy to a Kubernetes cluster on Linode via Github Actions
--
I recently decided to start working on a small side project, whereby I wanted to automate the deployment so that I can write code without having to think about how and when I’ll deploy the changes.
Being that I didn’t want to spend much on hosting I decided that I would host the instances on Linode (additionally they have a Sydney datacenter).
** Note: this tutorial will also work with private dockerhub repositories!
Before we get started started
In order to follow along with this tutorial, it’d be worth creating accounts with the following services/platforms:
- Github account — the reason is because this tutorial is focused around github actions.
- Docker hub account — this will be used to host your docker repository.
At the time of writing they have 1 free private repository. - Linode account — this will be where we host our kubernetes cluster.
You could very easily use another cloud provider if you wished such as Digital ocean.
Create a Kubernetes Cluster
We’ll start off by creating out Kubernetes cluster in Linode as it can take some time for it to provision.
To do this we’ll click the “Create” button at the top of the screen, and then select Kubernetes.
Then we’ll give our cluster:
- a name — it cannot contain special characters, spaces or underscores.
- a region — this can be anything; I’d suggest finding a region with the least amount of latency.
- a kubernetes version — I simply chose the newest version
- a node — since we are getting started, I just added 1x Linode 2GB to keep costs at a minimum. In production you’d obviously want more nodes in your cluster.
Once we click “Create Cluster”, Linode will create our Kubernetes cluster — this will take some time to provision so we can move on with the rest of our deployment.