1. EKS ( Elastic Kubernetes Service, 표준 쿠버네티스 )
- AWS에서 쿠버네티스를 손쉽게 실행하도록 지원하는 관리형 서비스
( Control Plane, MasterNode, WorkerNode를 모두 관리 )
- 높은 관리비용 (클러스터 관리), 구축 난이도(ECS or App Runner보다 복잡)
- Data Plane의 타입
EC2 ( High Performance, Customizing )
Fargate ( managed by AWS, Serverless, GPU X )

1) 기본 설정 _ 실습 구성
① aws cli 및 자격증명, kubectl/eksctl/node 설치
- region 변경은 aws configure로 진행
② ECR(Elastic Container Registery) 생성
- 도커 사용을 위해 생성된 이미지 저장소, 특정 리전에 생성
//AWS CLI설치, node설치, AWS자격증명(aws configure)수행 생략
//kubectl 설치
kubectl version --client
Client Version: v1.34.0
Kustomize Version: v5.7.1
//eksctl version
brew install eksctl
eksctl version
0.214.0-dev+c191958aa.2025-08-27T08:07:06
//ECR 생성 및 확인
aws ecr create-repository --repository-name hello-world-app --region ap-northeast-1
{
"repository": {
"repositoryArn": "arn:aws:ecr:ap-northeast-1:857360183365:repository/hello-world-app",
"registryId": "created_repository_Id",
"repositoryName": "hello-world-app",
"repositoryUri": "created_repository_Id.dkr.ecr.ap-northeast-1.amazonaws.com/hello-world-app",
"createdAt": "2025-09-08T10:57:08.511000+09:00",
"imageTagMutability": "MUTABLE",
"imageScanningConfiguration": {
"scanOnPush": false
},
"encryptionConfiguration": {
"encryptionType": "AES256"
}
}
}
aws ecr describe-repositories --region ap-northeast-1

③ 간단한 앱 구현 (node 사용)
- 기본 구성: 기본 app내용 구성, node_modules, package.json 적용
// npm 설치로 node_modules생성 (npm i)
// ESM설정 및 script추가 (package.json)
"type": "module",
"start": "node index.js" //시작 명령어 추가
//빌드, 구동
docker build -t hello-eks .
docker run -d -p 3000:3000 --name my-app hello-eks
//실행 및 정상 구동확인
curl localhost:3000
Hello, World from EKS !!!% //출력내용
(2) 도커 설정
- VPC, 인스턴스를 비롯해 관련 설정을 모두 함께 생성 (region에 의존)
//빌드
docker build --platform linux/amd64 -t todolist-app .
// create image tag (AWS의 ECR로 전해질 태그 생성)
docker tag hello-eks account_id.dkr.ecr.ap-northeast-1.amazonaws.com/lje-hello-world-app:v1
// Login (temp token for region/usename and token(std input)
aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin 계정_id.dkr.ecr.ap-northeast-1.amazonaws.com
//Push Image (to ECR )
docker push 계정_id.dkr.ecr.ap-northeast-1.amazonaws.com/lje-hello-world-app:v1
...
9ab76c0bb3e1: Pushed
39110bf180ce: Pushed
127c05f5df6b: Pushed
5a8e8228254a: Pushed
6daae2085e5b: Pushed
c149c7c96aa9: Pushed
8af6a2ce6edf: Pushed
6e174226ea69: Pushed
7a38a4f976c8: Pushed
v1: digest: sha256:080c5973ecb587553313a13545a7cfd7a5d4a7145000b0f938b17afb812007f9 size: 856
2) 3Tier배포 _ 실습 구성 _ Resource(EC2)
- 기존의 todolist app의 백엔드 EKS로 배포
- RDS, EKS, ECR(Image Registery), CloudFront(Frontend, Backend 연결)
(1) CloudFront & S3
//로컬과 s3 sync (aws cli)
aws s3 sync ./dist s3://[my-bucket-name]
(2) AWS에 배포
배포용 레포지토리 생성 - 이미지 빌드 및 레지스트리 등록
# Create Repository
aws ecr create-repository --repository-name todolist-app --region ap-northeast-1
# Image Build based on AMD64 (if base-architecture is ARM )
docker build --platform linux/amd64 -t todolist-app .
docker tag todolist-app [my_account_id].dkr.ecr.ap-northeast-1.amazonaws.com/todolist-app:v1
# Login (region)
aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin [my_account_id].dkr.ecr.ap-northeast-1.amazonaws.com
# Push
docker push [my_account_id].dkr.ecr.ap-northeast-1.amazonaws.com/todolist-app:v1
# Cluster
eksctl create cluster --name [cluster이름] --region ap-northeast-1
(3) RDS생성 ( database 생성 필수 )
- 기본 DB 생성 (필수)
- 백엔드 ( 쿠버네티스의 노드 그룹 ) 에 대한 인바운드 트래픽 규칙 추가 (동일 VPC)

(4) Kubernetes 배포
① manifest ( deployment, service, secret )
#Deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo-list-deployment
labels:
app: todolist-app
spec:
replicas: 2
selector:
matchLabels:
app: todolist-app
template:
metadata:
labels:
app: todolist-app
spec:
containers:
- name: todolist-app
image: [account-id].dkr.ecr.ap-northeast-1.amazonaws.com/todolist-app:v1
ports:
- containerPort: 8080
env:
- name: DB_HOST
valueFrom:
secretKeyRef:
name: mysql-secret
key: DB_HOST
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
name: mysql-secret
key: MYSQL_DATABASE
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: mysql-secret
key: MYSQL_USER
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-secret
key: MYSQL_PASSWORD
#Service.yaml
apiVersion: v1
kind: Service
metadata:
name: todolist-service
spec:
selector:
app: todolist-app
ports:
- port: 80
targetPort: 8080
protocol: TCP
type: LoadBalancer
② apply to kubernetes cluster
# 관련 Yaml파일이 존재하는 폴더에서 배포
kubectl apply -f secret.yaml
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
# 전체 조회
kubectl get all
NAME READY STATUS RESTARTS AGE
pod/todo-list-deployment-d6c5b6... 1/1 Running 0 64s
pod/todo-list-deployment-d6c5b6... 1/1 Running 0 64s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.100.0.1 <none> 443/TCP 112m
service/todolist-service LoadBalancer 10.100.78.67 a54fce6e.....ap-northeast-1.elb.amazonaws.com 80:32225/TCP 54s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/todo-list-deployment 2/2 2 2 64s
NAME DESIRED CURRENT READY AGE
replicaset.apps/todo-list-deployment-d6c5... 2 2 2 64s
(4) CloudFront배포 (벡엔드)
- 원본 생성 & 동작 설정


** Fargate로 구성 ( Serverless )하면 비용면에서 유리
eksctl create cluster --name [cluster이름] --region ap-northeast-1 --fargate
- Cluster구성 : 위의 명령으로 fargat와 동시에 구성 권장 ( Cluster생성 후 fargate구성을 하면 DNS 문제가 생길수 있음 )
- RDS 보안그룹 : ClusterSharedNodeSecurityGroup에 대한 보안그룹 설정 (보다 적절)및 인바운드 트래픽 추가(3306)

//addon의 구성 (config.yaml, vpc-cni에 애드온 )
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: <your-cluster-name>
region: ap-northeast-1
addons:
- name: vpc-cni
version: latest
attachPolicyARNs:
- arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy
// OIDC활성화
eksctl utils associate-iam-oidc-provider --cluster=<my-cluster-name> --approve
// vpc-cni에 애드온에 필요한 권한 업데이트
eksctl update addon --config-file=config.yaml --force
- CloudFront 설정 ( service.yaml을 실행한 결과의 External IP)

- 로드밸런서의 보안그룹을 clustersharedNodeSecurityGroup의 인바운드에 8080으로 추가
_________________________________________________
Problem Solving :
① 백엔드 이미지 에러 : ARM기반으로 빌딩한 이미지가 EKS로 deploy할때 Error발생 (AMD로 빌드)
② DB 연결
- RDS 생성시에 백엔드의 기본 DB생성
- EKS의 VPC와 Subnet적용
③ CloudFront
- 프론트엔드 : 초기 실패시 관련 기록을 무효화하여 삭제 필요
- 백엔드(추가) : 원본 연결 후 동작 설정
'Infra' 카테고리의 다른 글
| AWS_Cloud_5th (0) | 2025.09.04 |
|---|---|
| AWS_CLOUD_2nd (3) | 2025.08.23 |
| AWS_CLOUD_1st (4) | 2025.08.22 |
| Spring Cloud MSA_1 (0) | 2025.08.07 |