DevOps Project-5
Project Description
The project involves deploying a Netflix clone web application on a Kubernetes cluster, a popular container orchestration platform that simplifies the deployment and management of containerized applications. The project will require creating Docker images of the web application and its dependencies and deploying them onto the Kubernetes cluster using Kubernetes manifests. The Kubernetes cluster will provide benefits such as high availability, scalability, and automatic failover of the application. Additionally, the project will utilize Kubernetes tools such as Kubernetes Dashboard and kubectl to monitor and manage the deployed application. Overall, the project aims to demonstrate the power and benefits of Kubernetes for deploying and managing containerized applications at scale.
🔶 Task: Deployment of Netflix Clone on Kubernetes
Follow the steps given in the below link to create a working Kubernetes cluster with kubeadm made up of master and worker nodes.
Verifying the Cluster
Confirm the successful formation of the cluster by checking the status of all nodes using the command
kubectl get nodes
.Clone the Netflix Clone application from GitHub using the command:
git clone https://github.com/pmgoriya/netflix-clone-react-typescript.git
Build the Docker Image:
a. Navigate to the project directory after cloning.
b. Locate the Dockerfile and confirm it contains the required dependencies and configurations for the Netflix Clone web application.
c. Build the Docker image using the command:
sudo docker build -t pmgoriya/netflix-clone .
Docker Run:
sudo docker run -d pmgoriya/netflix-clone
Log in to Docker Hub and push the image:
sudo docker push pmgoriya/netflix-clone:latest
Verify if the image has been successfully pushed.
🔶 Kubernetes Deployment and Service Configuration:
Apply the following Kubernetes YAML files:
Deployment YAML (
deployment.yml
):apiVersion: apps/v1 kind: Deployment metadata: name: netflix-app labels: app: netflix-app spec: replicas: 2 selector: matchLabels: app: netflix-app template: metadata: labels: app: netflix-app spec: containers: - name: netflix-app image: pmgoriya/netflix-clone ports: - containerPort: 80
Apply using:
kubectl apply -f deployment.yml
Service YAML (
service.yml
):apiVersion: v1 kind: Service metadata: name: netflix-app labels: app: netflix-app spec: type: NodePort ports: - port: 80 targetPort: 80 nodePort: 30007 selector: app: netflix-app
Apply using:
kubectl apply -f service.yml
🔶 Verification:
Check the status of the deployment, pods, and service:
kubectl get deployment
kubectl get pods
kubectl get service netflix-app
🔶 Accessing Netflix Clone App:
After deployment, access the Netflix Clone app using the public URL. Ensure that you have added a Custom TCP Rule (30007) to the worker node in the security group.
With the inbound rule added, you can now access the Netflix Clone app through <worker_node_external_ip>:30007
in your web browser.
Thanks for following the project. See you in the next one.