Skip to content

Showcase of my DevOps learning & Demo projects. In this project, we will be creating a JAVA application, containerizing it with Docker and deploy on Kubernetes.

Notifications You must be signed in to change notification settings

dv-sharma/DevOps_Project-1

Repository files navigation

DevOps-Projects

**DEMO: CREATING JAVA APP, CONTAINERIZING WITH DOCKER & DEPLOYING ON KUBERNETES CLUSTER. **

STEP 1: CREATE A SPRINGBOOT JAVA MAVEN PROJECT USING SPRING INITIALIZER ⦁ Add the required dependencies e.g., SPRING WEB. ⦁ Chose the java version according to the needs. image

This is a simple java application with functionality to display the string when user hits “docker-run” URL.

image

⦁ Run and test the application on the port where it is running.

STEP 2: Getting the JAR in target folder using clean install command. PROJECT-> RUN AS -> MAVEN BUILD -> GOALS (CLEAN INSTALL)

image

STEP 3: CREATE A Docker file with this name and no extension. (Docker build reads from this file the instructions and builds the images accordingly).

image

STEP 4: CREATE A DOCKER HUB REPOSITORY TO STORE YOUR IMAGE. image Sample Repository where I will store my image.

STEP 5: BUILDING THE DOCKER IMAGE & PUSHING IT TO THE DOCKER HUB REPOSITORY. ⦁ Go into the directory where the Dockerfile is stored. ⦁ Then build that docker file using the command. ⦁ //Docker build . ⦁ Tag the image according to the version with the command ⦁ // docker tag <image name/id> /: ⦁ Push the image to the repository: ⦁ docker push 05061120/helloworlddv:tagname

image

The image will look like this in the repository. image

⦁ Delete the image from your local system. To check if the docker run command pulls it from docker hub repo. Docker run

The image runs successfully! image

Container on which this image is running. image

STEP 6: CREATING A DEPLOYMENT WITH YAML FILE AND DEPLOYING IT.

The yaml file which contains all the declarative details for the pod creation , replication control and port listing.

image image

STEP 7: EXPOSING THE DEPLOYMENT TO A SERVICE The yaml file for the svc looks like this. image

Here we are using a service of type NodePort to expose the deployment on a node port which directs to another port which then sends the request to the containers port. image

Let's try to access our application on port 32000 now with the given url.

image

THANKS!

About

Showcase of my DevOps learning & Demo projects. In this project, we will be creating a JAVA application, containerizing it with Docker and deploy on Kubernetes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published