Here is an example of setting up github actions, and deploying to a microk8's cluster

I created a workflow, yaml, etc to deploy using github actions to my microk8’s cluster running on pi’s.

Here is the workflow: gokub-tester/build-deploy.yml at main · horvatic/gokub-tester · GitHub

Using kustomize to handle the apply. Yaml is stored here: gokub-tester/deploy at main · horvatic/gokub-tester · GitHub

A few note if you chose to follow this, or fork from it:

  • The public ip of the network must be added to /microk8s/current/certs/csr.conf.template. Link to discussion: Is there a way to access microk8s using kubectl outside the local network

  • You must generate a kube config and change the server address to be the network public ip. This link will help generate the kube config MicroK8s - Working with kubectl. NOTE YOU MUST CHANGE THE SERVER TO BE THE NETWORKS PUBLIC IP. This kubeconfig then needs to be base64 encoded and upload as a secret to the github repo

  • The network port 16443 must be open on the network.

  • The dev, and prod environment must be created in github

  • Docker login must be added to the github secrets aswell

  • If you clone and apply the ${TAG} must be changed to a valid tag before applying