Pre-requisite:-
Sample Java application.
Install Git, Maven, Docker & K8s Cluster.
Step 1 - Clone the Git Project Repo
Step 2 - Create a Target folder for each service using mvn & Create a Docker image.
First, go inside each service and give the mvn clean install command which will create a jar file for our Java application.
Then give the command docker build -t <image-name> .
To check docker image >> docker images
Then store the Docker Images in the Docker hub as a Backup by using the docker push command.
After pushing it to the docker hub it will look like the below image.
Step 3 - Deploy our Application using K8s.
Go inside the Kubernetes folder >> cd Kubernetes
Give the command to create pods, services, and deployment >> kubectl apply -f example.yaml/yml
Check whether our pods are running or not >> kubectl get pods
Check our Services >> kubectl get svc
Check our Deployments >> kubectl get deployment
Step 4 - Check whether our Application is running on a live server or not.
First, give the port number of each service to your master and node Security Groups manually.
Then copy our public IP and add the port number where our particular service is running such as 3.109.60.213:32640.
Home Page of our Java Application
Stock Page of our Application
Product Catalogue Page of our Application
Step 5 - Clean Up our Instances.
Remember if you want to avoid billing in your Cloud Account always clean up your Instances after your use.
First delete k8s cluster >> kops delete cluster --name=<cluster-name> --yes
Delete all your k8s work >> kubectl delete all --all
Lastly, terminate your Instances.
\>>>>>>>>>>>>>>>>>>>>> Thank You <<<<<<<<<<<<<<<<<<<<<<<<