KubernetesSeries
If you have any questions or encounter any issues, feel free to leave a comment below! I’ll respond or update the content accordingly. “:)”
🚀 Table of Contents
- ➡️ Create a Spring Boot Project
- Dockerize the Application
- Deploy to Kubernetes (NodePort)
- Configure Ingress Routing
- Install Local GitLab
- Connect Git to GitLab
- Install ArgoCD
- Create ArgoCD Application
- Setup GitOps Flow
- Setup GitLab Runner
- Auto Image Tag & Sync
✅ Step 1: Create a Spring Boot Project using start.spring.io
In this step, we’ll create a basic Spring Boot application using Spring’s official initializer website.
This application will be used later to containerize with Docker and deploy to Kubernetes.
🧱 1.1 Generate the Project
Go to 👉 https://start.spring.io
Fill in the form with the following configuration:
Then, click Generate to download the .zip
file.
Unzip it and open the folder in your terminal or IDE.
🧪 1.2 Run the Project
In terminal, navigate to the project directory and run:
cd k8sdemo
./mvnw spring-boot:run
✨ 1.3 Add /hello
Endpoint
Open the main application file src/main/java/com/example/k8sdemo/K8sdemoApplication.java
and update it as follows:
package com.example.k8sdemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class K8sdemoApplication {
public static void main(String[] args) {
SpringApplication.run(K8sdemoApplication.class, args);
}
@GetMapping("/hello")
public String hello() {
return "Hello, Kubernetes!";
}
}
Now restart the application and access the endpoint:
cd k8sdemo
./mvnw spring-boot:run
Now restart the application and access the endpoint:
curl http://localhost:8080/hello
You should see the response:
Hello, Kubernetes!
This confirms your Spring Boot REST endpoint is working as expected.
댓글남기기