- Working in AWS
- Using Jenkins or Circle CI to implement Continuous Integration and Continuous Deployment
- Building pipelines
- Working with Ansible and CloudFormation to deploy clusters
- Building Kubernetes clusters
- Building Docker containers in pipelines
All tools required for this project are listed below. I have also set up an EC2 instance which will host/communicate with these tools and essentially serve as the management centre for this project.
- Jenkins (incl. Blue Ocean plugin) https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-22-04
- Docker https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
- Kubernetes https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html
- EKS https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html
- AWS/AWS-CLI https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
- Github To integrate with Jenkins https://www.cprime.com/resources/blog/how-to-integrate-jenkins-github/
- Hadolint https://stackoverflow.com/questions/62369711/how-to-install-hadolint-on-ubuntu
- Tidy
sudo apt install tidy - Bash
A simple Nginx "Hello World" application defined here and here. The webpage will have a blue or green background depending on how the load balancer is configured.
My linting stage contains two jobs: linting the docker file using hadolint and linting the html using tidy. A successful linting job is shown here. A failed linting job is shown here and can be triggered by adding some erroneous syntax to the docker file or html file.
This is done by calling the run_docker.sh script from the blue/green folder with the tag name as the argument.
This is done by calling the upload_docker.sh script from the blue/green folder with the tag name, docker username and docker password respectively as the 3 arguments. Proof of a successful upload to the docker hub is shown here. Also note that for these stages rely on docker credential configuration within jenkins.
Deploys the cluster using EKS and cloud formation. This stage (and the remaining stages) rely on aws credential configuration within jenkins. The cluster status is shown here and the status of the pods are shown here.
Updates kubeconfig and configures kubectl from AWS EKS as shown here.
Deploys a container using the docker image with tag=blue or tag=green. Replication controller status is shown here. Jenkins console output for these steps is shown here and here.
Starts the blue/green service on the worker nodes. Status of services are shown here.
The application can be tested by using the DNS Name and Port the load balancer is running on - this information is shown here. The last stage of the Jenkins pipeline is to run the green service so we can see the "Hello World" text with the green background in the web browser.
This can be easily switched back to the blue version by running the "Run Blue Service" command.
kubectl apply -f ./k8s/blue/blue-controller.json

