Whole Project Code Available Here
We will have a deployment over a Kubernetes cluster
using Jenkins CI/CD pipeline
,
in this project, we are taking the help of various DevOps tools like GitHub, Jenkins,
Ansible and a Kubernetes cluster(2 nodes)
.
We will also learn about Kubernetes to know about this deployment and services and we
will write Ansible playbooks
with it, we will also write Dockerfile
.
-
When the developer writes a Docker file, he pushes it to the
GitHub repository
so whenever there is a new commit to the GitHub repo When the new code arrives it
Notifies Jenkins via a webhook, and Jenkins starts the pipeline. -
Jenkins pulls all the code from the GitHub repository Once it's completed, it will
ssh to the ansible server so when a developerpushes
a docker file it accesses the
Ansible server and starts running the image. -
When it gets the docker file it starts building the image based on the docker file It
tags it, and oncetagged
it pushes to the Docker hub and the second task of the Ansible
Server is, it will ssh to our Kubernetes cluster server, which will evaluate and ansible
will execute the playbook. -
It runs the
kubectl
command on our Kubernetes cluster(web app) and it tries to get the
latest image from the docker registry .It will pull from the docker hub and it will start
building the image, it will build a container and that container should be available to
us using annode IP
and aport
which we specified in theService.yaml
-
We're going to start by writing
Service.yaml
and hand it over to the Kubernetes cluster
So this is the whole scenario in simple terms was going to achieve aKubernetes deployment
-
The Jenkins CI/CD pipeline uses various tools We use
Linux
commands, Jenkins, and Docker
and you need to have aDockerhub account
, so onceAnsible Server
builds a Docker image
based on the Docker file, we push it to the Docker Hub. -
So we need to log in to Docker Hub here so we can easily push the latest image so what
we're trying to accomplish here is we have the latest image and we also maintain a
version based on the build -
It builds v1, it contains a fresh image, If the second time it builds another image v2
so that the second contains the latest image, we areperforming a version
, also, we have
to separate thelatest image
.
- Server Setup
- Dockerfile - Configure Webhook - Trigger Jenkins Job - git
- Transfer & Execute files on remote server using SshAgent
- Build docker Images using Dockerfile - Tag docker images
- Complete Declarative CI/CD Pipelines in Jenkins Project - Push Images to DockerHub
- Complete Deployment on Kubernetes cluster using jenkins CI/CD
Give a ⭐️ if this project helped you, Happy learning!