Table of Contents
A simple Java application leveraging the Spring Boot framework to implement a RESTful API with configurations for virtualized deployment into Docker containers within a Kubernetes cluster.
An IDE such as IntelliJ is recommended for building and running the project, but the same functions can also be run from the command line.
For Docker and Kubernetes deployments you will need to install the following:
Recommended:
- Clone the repo
git clone https://github.com/GarrettCooperDev/Showcase.git
- Use Maven to build the project
- If you are using an IDE such as IntelliJ use the Maven tool window to run the 'install' command
- Maven can also be run from the command line
mvn install
- Docker Deployment
- If you are using an IDE such as IntelliJ, the Dockerfile and compose.yaml files have already been configured and running the application will automatically build a new image and run a Docker container
- Docker can also be run from the command line
docker build -t showcase . docker run -p 8000:8080 showcase
- Kubernetes Deployment using minikube
- Start the minikube cluster
minikube start
- Push the ConfigMap to the cluster
kubectl kubectl apply -f showcase-config.yaml
- Push the Secret
kubectl kubectl apply -f showcase-secret.yaml
- Push the showcase.yaml file that contains the configuration for both the Service and the Deployment
kubectl kubectl apply -f showcase.yaml
- The application should now be running in the Kubernetes cluster, get the IP address of the cluster by calling
minikube ip
- Start the minikube cluster
- Call the API within the docker container
- Use PostMan to make a GET request to the following URL
http://localhost:8000
- The same request can also be made using curl from the command line
curl http://localhost:8000
- To call the API in the Kubernetes cluster replace http:localhost:8000 with the IP address of the cluster and append the nodePort number 30100
- Use PostMan to make a GET request to the following URL
- Spring Boot RESTful API
- Docker Containerization
- Kubernetes Deployment
- Unit Testing with JUnit5 and Mockito
- Database Access
- H2 InMemory Database
- PostgreSQL
- Spring beans and dependency injection
See the open issues for a full list of proposed features (and known issues).
Garrett Cooper - [email protected]
Project Link: https://github.com/GarrettCooperDev/JavaShowcase