A personal endeavor to learn and demonstrate various DevOps concepts: Docker, Kubernetes, Helm, and Terraform — all wrapped around a Spring Boot application.
- Spring Boot Application: A simple RESTful API built with Spring Boot, showcasing basic CRUD operations and exposing monitoring endpoints.
- Docker: Containerization of the Spring Boot application for consistent environments.
- Kubernetes: Deployment and management of the application on a Kubernetes cluster using various manifest types (Deployments, Services, etc.).
- Helm: Packaging and deploying the application to Kubernetes using Helm charts for easier management and versioning.
- Terraform: Infrastructure as Code (IaC) for provisioning and managing the necessary cloud resources (current state focuses on local configurations, but the structure is in place for cloud integration).
- CI/CD: (Implied/Expandable) The project structure allows for the integration of CI/CD pipelines to automate builds, tests, and deployments.
Ensure the following are installed before you begin:
- JDK 17
- Maven
- Docker
kubectl
- Helm
- Terraform
- A running Kubernetes cluster (Minikube, Docker Desktop with Kubernetes enabled, or a cloud-based cluster)
git clone https://github.com/your-username/DockerPoc-1.git
cd DockerPoc-1
mvn clean package
This will create an executable JAR file in the target
directory.
-
Build the Docker Image:
docker build -t dockerpoc-1 .
This command builds a Docker image named
dockerpoc-1
using theDockerfile
in the root directory. -
Run the Docker Container:
docker run -p 8080:8080 dockerpoc-1
This runs the Docker container and maps port 8080 on your host to port 8080 in the container.
Kubernetes manifests are located in the K8s_Yaml
directory.
-
Apply the Manifests:
kubectl apply -f K8s_Yaml/
This command applies all the Kubernetes configuration files in the
K8s_Yaml
directory to your connected Kubernetes cluster. -
Verify the Deployment:
kubectl get pods kubectl get services
Check the status of your pods and services to ensure the application is running correctly.
The Helm chart for this project is located in the charts/Helm
directory.
-
Add the Helm Repository (if hosted): If you have hosted your Helm chart in a repository, you can add it using:
helm repo add my-repo https://your-helm-repo-url helm repo update
-
Install the Helm Chart: Navigate to the
charts/Helm
directory and install the chart:cd charts/Helm helm install dockerpoc-release .
This will deploy the application to your Kubernetes cluster using the configurations defined in the Helm chart.
-
Uninstall the Helm Chart: To remove the deployment created by Helm:
helm uninstall dockerpoc-release
Terraform files are located in the Terraform
directory. While the current configuration might be minimal, the intention is to use Terraform for provisioning infrastructure.
-
Initialize Terraform:
cd Terraform terraform init
-
Review the Plan:
terraform plan
This command shows you the changes Terraform will make to your infrastructure.
-
Apply the Configuration:
terraform apply
This command applies the Terraform configuration to provision the resources.
Once the application is deployed, you can typically access it through a Service (Kubernetes) or by port-forwarding to a pod. Refer to the specific deployment method's documentation for details.
- API Endpoints: The Spring Boot application exposes various REST endpoints.
- Actuator Endpoints: Monitoring information is available via Spring Boot Actuator (e.g.,
/actuator/health
,/actuator/metrics
). - Swagger UI: API documentation is available through Swagger UI (commonly
/swagger-ui.html
, depending on your configuration).
This project is designed as a learning tool. Feel free to explore the code and configurations to understand how the different technologies are integrated. Experiment with different deployment strategies, modify the application, and observe the impact on the deployment process.
As this is a personal learning project, contributions are not actively sought, but you are welcome to fork the repository and use it for your own learning purposes.
This project is licensed under the MIT License.
Thanks to the open-source communities of Spring Boot, Docker, Kubernetes, Helm, and Terraform for providing these incredible tools.