chris-tn / docker-kubernetes-hello-world

Docker & Kubernetes Hello World

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hello World with Docker and Kubernetes

This repo consists of a Spring Boot Hello World application. It shows:

  1. Run & test the application from CLI

  2. Create a Docker image, run the container and test it

  3. Create Kubernetes deployment and test it

Let’s get started!

CLI

Run App

mvn spring-boot:run

Test Application

curl http://localhost:8080

Docker

Build Application

mvn clean package

Build Docker Image

docker image build -t arungupta/helloworld-spring-boot:latest .

Push Docker Image

docker image push arungupta/helloworld-spring-boot:latest

Run Docker Container

docker container run -d --name hello-world -p 8080:8080 arungupta/helloworld-spring-boot:latest

Test Application

curl http://localhost:8080

Delete Docker Container

docker container rm -f hello-world

Kubernetes

Create Deployment

kubectl apply -f deployment.yaml

Test Application

curl http://`kubectl get svc hello-world-service -o jsonpath={.status.loadBalancer.ingress[0].hostname}`

Delete Deployment

kubectl delete -f deployment.yaml

About

Docker & Kubernetes Hello World

License:Apache License 2.0


Languages

Language:Java 54.4%Language:Makefile 36.1%Language:Smarty 7.6%Language:Dockerfile 1.9%