Jenkins CI/CD pipelines for Kubernetes Appilication: Continuously Build and Deliver to Amazon EKS Cluster
End-to-End Jenkins CI/CD pipelines for Kubernetes application. Use blue/green deployment strategy to deliver/deploy to a cluster on Amazon Elastic Kubernetes Service.
bin/setup_jenkins_ubuntu.sh- All the commands to setup an EKS-ready Jenkins.
- This file is for reference only. DON'T RUN!
bin/create_cluster_eks.sh- Automatically create/update the roles & network used by EKS, and then create/update the cluster & its node group.
- Same code is used in Jenkinsfile.
bin/deploy_k8s_app.sh- Deploy the Kubernetes application using
kubectl. - Same code is used in Jenkinsfile.
- Deploy the Kubernetes application using
In the develop branch:
- Commit the changes for the new version.
- Update the
VERSIONvariable in Jenkinsfile and commit. - Push
developto trigger CI stages in pipeline.
In the staging branch:
- Pull and merge the latest
developbranch. - Push
stagingto trigger CD stages in pipeline (will be deployed to a copy of production environment).
If everything is ready for production:
- Checkout a
release/**branch fromstagingbranch. - Push and merge the branch to
master - Push
masterto trigger CI+CD stages in pipeline (will be deployed to the ACTUAL production environment).
-
Assume that you already have an app running at version
1.0. -
And you make the following changes for a newer version
1.1.sed -i "s/World/New World" app/app.py sed -i "s/World/New World" tests/test_app.py
-
Update the version from
1.0to1.1in Jenkinsfile.Otherwise the existing version will be OVERWRITTEN after running the pipeline.
sed -i "s/VERSION = '1.0'/VERSION = '1.1'/" Jenkinsfile -
Commit changes to
develop, push to trigger the pipeline for CI.