This project involves setting up a Kubernetes cluster on AWS and configuring CI/CD pipelines with Jenkins. The project covers infrastructure provisioning using Terraform, configuration management with Ansible, and deploying an e-commerce application using Jenkins and Kubernetes.
- Tools Used: Terraform
- Resources Provisioned:
- VPC: Virtual Private Cloud
- Internet Gateway: For internet access
- EC2 Instances:
- Master Node: Central node for Kubernetes control
- Worker Nodes: Nodes for running application workloads
- S3 Bucket: For storage needs
- Route Tables: To manage traffic routing
- Security Groups: To control access to instances
- Subnets: Public and private subnets for network isolation
- Navigate to the Terraform Directory:
cd path/to/terraform/directory terraform init terraform fmt terraform validate terraform plan terraform apply #terraform destroy
- Tools Used: Ansible
- Tasks Performed:
- Installed Kubernetes components (
kubeadm
,kubelet
,kubectl
) - Configured the master node and initialized the Kubernetes cluster
- Connected worker nodes to the master node using Ansible playbooks:
kube-dependencies.yml
: Installs required dependenciesmaster.yml
: Configures the master nodeworkers.yml
: Configures the worker nodeshelm.yml
: Installs and configures Helm
- Installed Kubernetes components (
ansible all -i path/to/inventory/file -m ping
ansible-playbook -i path/to/inventory/file kube-dependencies.yml
ansible-playbook -i path/to/inventory/file master.yml
ansible-playbook -i path/to/inventory/file workers.yml
ansible-playbook -i path/to/inventory/file helm.yml
- Tools Used: Helm
- Steps:
- Installed Helm on the master node
- Deployed Jenkins using Helm charts on the Kubernetes cluster
- Configured Jenkins with necessary plugins for CI/CD
- Repository: Day38-devops
- Pipeline Includes:
- Source Code Checkout: Pulls code from GitHub
- Build Docker Image: Builds Docker images from the Dockerfile
- Push Docker Image: Pushes Docker images to Docker Hub
- Deploy to Kubernetes: Deploys the Docker image to Kubernetes using Helm
- Print Logs: Fetches logs from the deployment for verification
- Application: E-commerce application
- Steps:
- Built and pushed Docker image of the Node.js application
- Deployed the application on Kubernetes worker nodes
- Exposed the application using a Kubernetes Service
- Terraform Configuration: Defines AWS infrastructure
- Ansible Playbooks: Configures Kubernetes and Helm
- Jenkins Pipeline: Automates the CI/CD process
- Dockerfile: Defines the Docker image for the Node.js application
- Node.js Application: Source code for the application
-
Provision Infrastructure:
- Run Terraform scripts to create AWS resources.
-
Configure Nodes:
- Use Ansible playbooks to set up the master and worker nodes.
-
Install Jenkins:
- Deploy Jenkins using Helm and configure it for CI/CD.
-
Run Pipeline:
- Use Jenkins to build, push, and deploy the Docker image.
-
Deploy Application:
- The e-commerce application will be deployed on Kubernetes.
For more detailed information on each step, please refer to the respective scripts and configuration files in this repository.
Master and Worker Nodes: