Deploy to Kubernetes with Github Actions

Deploy to Kubernetes with Github Actions v0

Github Actions is now in limited public beta and while trying it out for deploying to Kubernetes, I built this workflow:

Lets go through it. This is workflow is based on the gcloud example action with my first own action which notifies me on Slack when the workflow is finished.

The first step is building my Dockerfile, I mentioned earlier and simultaneously logging into Google Cloud. I am running my Kubernetes Cluster on Google Cloud and using the Google Cloud Container Registry for my images. The image then gets tagged with the convenient tag action and pushed to the registry. Now I have image tagged with the branchname, short Git hash and the latest tag available.

The deploy to GKE action now uses the tag with the Git SHA and replaces the placeholders in my deployment file and applies it to the cluster.

After that the deployment gets verified and a Slack hook gets triggered to notify about the end of the workflow. The Slack hook is just a curl command to the URL I got from the Slack integration “Incomming webhooks”.

Work in progess! Post will be updated