Part 2 : Spring Boot서비스 EKS에 배포하기
🥅 Goal
Phase 1
Phase 2
🛠️ Tech Stack
👩🏻🏫 Subject
AWS EKS에 서비스 배포하기
AWS IAM Tutorial
🔥 Challenge'
Spring Boot + GitHub Actions + Docker + EKS 배포 아키텍처
vbnet복사편집┌───────────────────────┐
│ Developer │
│ - Push to GitHub │
└─────────┬─────────────┘
│
▼
┌────────────────────────────────────┐
│ GitHub Actions │
│ 1. Checkout Source │
│ 2. Build with Gradle/Maven │
│ 3. Docker Build & Tag │
│ 4. Push to ECR (Elastic Container Registry) │
│ 5. Deploy to EKS using kubectl │
└─────────┬──────────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ Amazon EKS (Kubernetes) │
│ │
│ ┌────────────┐ ┌────────────┐ │
│ │ Deployment │ --> │ Pod │ │
│ │ (Spring Boot) │ (Docker) │ │
│ └────────────┘ └────────────┘ │
│ ▲ ▲ │
│ │ Auto Scaling │ │
│ ┌────────────┐ ┌────────────┐ │
│ │ Service │ <-> │ Ingress │ <-> │
│ └────────────┘ └────────────┘ │
└────────────────────────────────────────┘
▲
│
▼
┌──────────────┐
│ Client/Web │
│ Browser │
└──────────────┘
⚙️ 구성 요소 설명
GitHub Actions
CI/CD 도구. GitHub에 push되면 자동으로 빌드 & 배포
Docker
Spring Boot 애플리케이션을 컨테이너화
ECR (Amazon Elastic Container Registry)
Docker 이미지 저장소
EKS (Elastic Kubernetes Service)
Spring Boot 컨테이너를 운영하는 Kubernetes 클러스터
Ingress Controller
도메인 기반 라우팅 및 HTTPS 처리 (ex: ALB + cert-manager)
Service + Deployment
Kubernetes 리소스로 Spring Boot 앱을 실행하고 관리
Pod
실제로 컨테이너가 실행되는 단위
Client
사용자는 브라우저 또는 모바일 앱으로 접근
🛠️ 추가 참고 (실제 YAML 구성 요소)
GitHub Actions에서 사용하는 주요 단계:
actions/checkout
docker build
,docker push
(to ECR)aws eks update-kubeconfig
kubectl apply -f deployment.yaml
EKS 내 Kubernetes 리소스 구조 포함
markdown복사편집사용자 브라우저
│
▼
┌──────────────┐
│ Ingress │ ← ALB 연동, HTTPS/도메인 처리
└─────┬────────┘
▼
┌──────────────┐
│ Service │ ← ClusterIP/LoadBalancer로 Pod 연결
└─────┬────────┘
▼
┌───────────────────────┐
│ Deployment │
│ (Spring Boot) │
│ - Pod 자동 관리 │
└─────┬─────────────────┘
▼
┌──────────────┐
│ Pod │ ← 실제 Spring Boot 컨테이너 실행
│ (Spring Boot)│
└──────────────┘
▲
│
▼
┌────────────────────────────┐
│ AWS RDS (MySQL) │ ← DB 연결
└────────────────────────────┘
GitHub Actions
│
├─ Docker Build → ECR에 Push
└─ `kubectl apply`로 Deployment 업데이트
웹에서 Python (.csv 다운로드 등)
│
└─ Python Script → AWS RDS에 적재
React (정적 리소스)
│
└─ S3 + CloudFront or Nginx로 별도 서빙
🧩 각 컴포넌트 설명
Ingress
외부 트래픽을 클러스터로 라우팅 (도메인 및 HTTPS 처리)
Service
Pod 앞단의 LoadBalancer 역할. 내부 라우팅 (ClusterIP), 외부 접근 (LoadBalancer/NodePort)
Deployment
Pod의 수, 롤링 업데이트, 재시작 관리
Pod
컨테이너가 실제 실행되는 단위
ECR
Docker 이미지 저장소
GitHub Actions
CI/CD 자동화로 Docker 빌드 & 배포
🛠️ Kubernetes 리소스 연결 흐름
GitHub Actions → ECR → EKS
GitHub Actions가 Docker 이미지를 빌드해서 ECR에 푸시하고,
kubectl
이나helm
으로 EKS에 배포 (Deployment
가 새 이미지로 갱신됨)
Ingress → Service → Pod
외부에서 오는 요청은 Ingress(ALB)를 통해 서비스로 전달되고,
Service가 Pod로 분배하여 처리
📦 파일 구성 예시
복사편집k8s/
├── ingress.yaml
├── service.yaml
├── deployment.yaml
├── configmap.yaml (선택)
└── secret.yaml (선택)
🧾 예시 Ingress.yaml
yaml복사편집apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: springboot-ingress
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
spec:
rules:
- host: your-domain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: springboot-service
port:
number: 8080
Last updated