A simple HTTP server written in Go.
This repository is used to demonstrate a rudimentary CI/CD pipeline for applications deployed to Kubernetes clusters using a GitOps process.
The CI/CD pipeline is used to completely automate the process of building, publishing and deploying an application from a single commit or PR merge.
The following diagram illustrates the various phases of the pipeline.
The Continous Integration phase is implemented using a GitHub Actions workflow.
This phase could also be built using other continuous integration tools/services such as Buildkite.
Builds the application and its Docker image.
Tags the Docker image with the current git commit sha.
Pushes the new Docker image to a Dockerhub image repository.
The docker image could also be pushed to any docker registry such as ECR.
Once the docker image has been published, the workflow updates the image tag in the Kubernetes deployment specs.
Since this is a rudimentary example, we use sed
to replace the :latest
tag with the docker image tag used in the previous steps.
The static Kubernetes configuration could also be generated with tools such as Helm and Kustomize.
The generated Kubernetes application configuration files are then committed to the configuration repository: https://github.com/etiennep/k8s-go-hello-http.
The deployment phase of the CI/CD pipeline is triggered once the updated kubernetes deployment specs are committed to the configuration repository.
This phase can be implemented using GitOps continous deployment tools such as ArgoCD and Flux.
This example is built using ArgoCD, ArgoCD ApplicationSets, and ArgoCD Notifications running in a local minikube cluster.
Once the updated specs are committed, ArgoCD automatically syncs the application on the target Kubernetes cluster(s). Once the sync is completed, the commit status is automatically updated, and a notification sent to a Slack channel.
Missing from this example are steps necessary to peform the following:
- Integration testing
- Benchmarking
- Canary testing