Project : KubeFlix: Deploying a Netflix Clone on Kubernetes
Project Objective : The project aims to deploy a Netflix clone web application on a Kubernetes cluster, leveraging containerization and Kubernetes manifests for streamlined deployment and management. Utilizing Kubernetes benefits, including high availability, scalability, and automatic failover, the project will showcase the power of Kubernetes for efficiently deploying and managing containerized applications at scale while emphasizing enhanced reliability and performance.
Prerequisite :
Before getting started, ensure you have set up three EC2 instances: one for the master and two for the nodes. Follow the steps in this script to set up Kubernetes:
https://github.com/patelajay745/Scripts/blob/main/k8sss.sh

Let's get started.
we will be using this github repo for this project : https://github.com/patelajay745/netflix-clone-react-typescript
Step 1 : clone the project into master :
step 2 : there will be Dockerfile so you can create docker image using this code.
docker build --build-arg TMDB_V3_API_KEY=your_api_key_here -t netflix-clone .
you can get api key from here : https://developer.themoviedb.org/docs/getting-started

step 3 : upload created docker image to dockerhub.

If you are facing problem in uploading image to dockerhub you can follow this blog :
https://myproject.ltd/project2
or you can use my created docker image using this url : https://hub.docker.com/repository/docker/patelajay745/netflix-clone/general
step 4 : Now create the Deployment yaml file.

apiVersion: apps/v1
kind: Deployment
metadata:
name: netflix-clone-deployment
labels:
app: netflix
spec:
replicas: 2
selector:
matchLabels:
app: netflix
template:
metadata:
labels:
app: netflix
spec:
containers:
- name: netflix
image: patelajay745/netflix-clone:latest
ports:
- containerPort: 80
step 5 : Run and check the successful running of Deployment in the instance.
kubectl apply -f deployment.yml

step 6: Create my-service.yml using following command
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
selector:
app: netflix
ports:
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
- port: 80
targetPort: 80
# Optional field
# By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
nodePort: 30007
Apply the service YAML file with the following command:
kubectl apply -f my-service.yml

Verify the status of your pods with:
kubectl get pods

Finally, access your Netflix clone application using the following URL:
https://<publicIP-node:30008>

Conclusion:
In this project, we successfully deployed a Netflix clone web application on a Kubernetes cluster. By containerizing the application and leveraging Kubernetes manifests, we demonstrated how Kubernetes offers high availability, scalability, and automatic failover, providing enhanced reliability and performance for containerized applications.



