This project centers around a comprehensive CI/CD pipeline, showcasing the integration of popular tools that are widely utilized in the field.
When you take a look at my GitHub repository, you'll notice several key files that play a crucial role in this pipeline's functionality.
project-root/
├── templates/
│ └── index.html
├── Dockerfile
├── app.py
├── Jenkinsfile
├── deployment-service.yml
├── script.groovy
├── .gitignore
└── requirements.txt
The repository contains files such as 'app.py,' which is a Flask web application." You can run it locally,
python3 app.py
To build the application image, I leverage a Dockerfile.
FROM python:3.7-alpine
COPY . /app
WORKDIR /app
RUN pip install flask
CMD ["python", "app.py"]
Check my docker hub repo at: https://hub.docker.com/repository/docker/taqiyeddinedj/my-repo
In the deployment stage of our CI/CD pipeline, I've crafted a Kubernetes Deployment configuration file, deployment.yml which defines the specifications for our application's deployment The accompanying Service configuration file, service.yml, defines how our application can be accessed
Inside the Jenkins container, I've included the Docker runtime, enabling it to build Docker images directly.
Using a webhook, any push to the repository automatically triggers the build process.
The pipeline consists of several distinct stages, each serving a specific purpose.
These stages include initialization, testing (which identifies the active branch), building and pushing to Docker Hub, and the final deployment to a Kubernetes cluster.
The pipeline is orchestrated using a Jenkinsfile, written in Groovy syntax.
Establishing my personal Kubernetes cluster quite challenging, but i made it work." Troubleshooting was a significant aspect of getting the cluster operational.
Connecting Kubernetes with Jenkins was a critical step. I discovered a helpful plugin on Stack Overflow, conveniently provided by the Jenkins community. stackoverflow-plugin
An obstacle I encountered was a certificate signing issue, likely related to port forwarding. This led me to seek a cluster accessible from the public network.
To address these challenges, I migrated to Microsoft Azure and successfully deployed a Kubernetes cluster.
There's a specific command that needs to be included in the Jenkinsfile for this Azure-based cluster setup.
kubernetesDeploy (configs: 'deployment-service.yml', kubeconfigId: 'kubernetes')
To ensure seamless connectivity, the kubeconfig file is stored in a hidden directory (.kube) within your home directory, and its contents are uploaded to Jenkins as special credentials.
Currently, the Azure-based Kubernetes cluster is up and running, serving as the backbone of our robust CI/CD pipeline."
In summary, i have taken you through the intricate process of establishing a comprehensive CI/CD pipeline. From the initial setup of Jenkins and Docker, to overcoming Kubernetes integration challenges, and finally transitioning to a reliable Azure-based cluster, we've covered a wealth of insights and practical steps.