Skip to content

Commit 374a125

Browse files
authored
feat: EKS 배포용 K8s 매니페스트 전체 구성 (#9)
1 parent c057bee commit 374a125

19 files changed

Lines changed: 688 additions & 40 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ docker-compose.override.yml
4242
k8s/*-secret.yml
4343
k8s/**/secret.yml
4444
k8s/secrets/
45+
k8s/secrets.yml
4546

4647
# =========================
4748
# Terraform (future)

k8s/auth-service/deployment.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,46 @@ spec:
1919
app.kubernetes.io/part-of: opentraum
2020
app.kubernetes.io/component: auth
2121
spec:
22+
terminationGracePeriodSeconds: 35
23+
imagePullSecrets:
24+
- name: harbor-registry-secret
25+
securityContext:
26+
runAsNonRoot: true
27+
fsGroup: 1000
28+
topologySpreadConstraints:
29+
- maxSkew: 1
30+
topologyKey: kubernetes.io/hostname
31+
whenUnsatisfiable: ScheduleAnyway
32+
labelSelector:
33+
matchLabels:
34+
app.kubernetes.io/part-of: opentraum
2235
containers:
2336
- name: auth-service
24-
image: opentraum/auth-service:latest
37+
image: amdp-registry.skala-ai.com/skala26a-cloud/opentraum-auth-service:latest
2538
ports:
2639
- containerPort: 8081
2740
protocol: TCP
41+
securityContext:
42+
runAsUser: 1000
43+
allowPrivilegeEscalation: false
2844
envFrom:
2945
- configMapRef:
3046
name: opentraum-config
47+
- secretRef:
48+
name: opentraum-secrets
3149
env:
32-
- name: SPRING_DATASOURCE_URL
33-
value: "jdbc:postgresql://opentraum-postgres:5432/opentraum_auth"
50+
- name: DB_NAME
51+
value: "opentraum_auth"
52+
- name: SPRING_R2DBC_URL
53+
value: "r2dbc:postgresql://opentraum-postgres:5432/opentraum_auth"
54+
- name: JAVA_TOOL_OPTIONS
55+
value: "-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0"
3456
resources:
3557
requests:
36-
memory: "128Mi"
37-
cpu: "250m"
38-
limits:
3958
memory: "256Mi"
59+
cpu: "150m"
60+
limits:
61+
memory: "512Mi"
4062
cpu: "500m"
4163
livenessProbe:
4264
httpGet:

k8s/configmap.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,23 @@ data:
1212
SPRING_DATASOURCE_HOST: "opentraum-postgres"
1313
SPRING_DATASOURCE_PORT: "5432"
1414
SPRING_DATASOURCE_USERNAME: "opentraum"
15+
DB_HOST: "opentraum-postgres"
16+
DB_PORT: "5432"
17+
DB_USERNAME: "opentraum"
1518

1619
# ---------------------------------------------------------------------------
1720
# Redis
1821
# ---------------------------------------------------------------------------
1922
SPRING_DATA_REDIS_HOST: "opentraum-redis"
2023
SPRING_DATA_REDIS_PORT: "6379"
24+
REDIS_HOST: "opentraum-redis"
25+
REDIS_PORT: "6379"
2126

2227
# ---------------------------------------------------------------------------
2328
# Kafka
2429
# ---------------------------------------------------------------------------
2530
SPRING_KAFKA_BOOTSTRAP_SERVERS: "opentraum-kafka:9092"
31+
KAFKA_BOOTSTRAP_SERVERS: "opentraum-kafka:9092"
2632

2733
# ---------------------------------------------------------------------------
2834
# Service Discovery (internal K8s DNS)
@@ -33,6 +39,25 @@ data:
3339
RESERVATION_SERVICE_URL: "http://reservation-service.opentraum.svc.cluster.local:8084"
3440
PAYMENT_SERVICE_URL: "http://payment-service.opentraum.svc.cluster.local:8085"
3541

42+
# ---------------------------------------------------------------------------
43+
# Gateway Route Override (prod profile 보완)
44+
# ---------------------------------------------------------------------------
45+
SPRING_CLOUD_GATEWAY_ROUTES_0_ID: "auth-service"
46+
SPRING_CLOUD_GATEWAY_ROUTES_0_URI: "http://auth-service:8081"
47+
SPRING_CLOUD_GATEWAY_ROUTES_0_PREDICATES_0: "Path=/api/v1/auth/**"
48+
SPRING_CLOUD_GATEWAY_ROUTES_1_ID: "user-service"
49+
SPRING_CLOUD_GATEWAY_ROUTES_1_URI: "http://user-service:8082"
50+
SPRING_CLOUD_GATEWAY_ROUTES_1_PREDICATES_0: "Path=/api/v1/users/**,/api/v1/tenants/**"
51+
SPRING_CLOUD_GATEWAY_ROUTES_2_ID: "event-service"
52+
SPRING_CLOUD_GATEWAY_ROUTES_2_URI: "http://event-service:8083"
53+
SPRING_CLOUD_GATEWAY_ROUTES_2_PREDICATES_0: "Path=/api/v1/concerts/**,/api/v1/schedules/**,/api/v1/admin/**"
54+
SPRING_CLOUD_GATEWAY_ROUTES_3_ID: "reservation-service"
55+
SPRING_CLOUD_GATEWAY_ROUTES_3_URI: "http://reservation-service:8084"
56+
SPRING_CLOUD_GATEWAY_ROUTES_3_PREDICATES_0: "Path=/api/v1/reservations/**,/api/v1/queue/**,/api/v1/live/**,/api/v1/lottery/**"
57+
SPRING_CLOUD_GATEWAY_ROUTES_4_ID: "payment-service"
58+
SPRING_CLOUD_GATEWAY_ROUTES_4_URI: "http://payment-service:8085"
59+
SPRING_CLOUD_GATEWAY_ROUTES_4_PREDICATES_0: "Path=/api/v1/payment/**"
60+
3661
# ---------------------------------------------------------------------------
3762
# Spring Common
3863
# ---------------------------------------------------------------------------

k8s/event-service/deployment.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,46 @@ spec:
1919
app.kubernetes.io/part-of: opentraum
2020
app.kubernetes.io/component: event
2121
spec:
22+
terminationGracePeriodSeconds: 35
23+
imagePullSecrets:
24+
- name: harbor-registry-secret
25+
securityContext:
26+
runAsNonRoot: true
27+
fsGroup: 1000
28+
topologySpreadConstraints:
29+
- maxSkew: 1
30+
topologyKey: kubernetes.io/hostname
31+
whenUnsatisfiable: ScheduleAnyway
32+
labelSelector:
33+
matchLabels:
34+
app.kubernetes.io/part-of: opentraum
2235
containers:
2336
- name: event-service
24-
image: opentraum/event-service:latest
37+
image: amdp-registry.skala-ai.com/skala26a-cloud/opentraum-event-service:latest
2538
ports:
2639
- containerPort: 8083
2740
protocol: TCP
41+
securityContext:
42+
runAsUser: 1000
43+
allowPrivilegeEscalation: false
2844
envFrom:
2945
- configMapRef:
3046
name: opentraum-config
47+
- secretRef:
48+
name: opentraum-secrets
3149
env:
32-
- name: SPRING_DATASOURCE_URL
33-
value: "jdbc:postgresql://opentraum-postgres:5432/opentraum_event"
50+
- name: DB_NAME
51+
value: "opentraum_event"
52+
- name: SPRING_R2DBC_URL
53+
value: "r2dbc:postgresql://opentraum-postgres:5432/opentraum_event"
54+
- name: JAVA_TOOL_OPTIONS
55+
value: "-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0"
3456
resources:
3557
requests:
36-
memory: "128Mi"
37-
cpu: "250m"
38-
limits:
3958
memory: "256Mi"
59+
cpu: "150m"
60+
limits:
61+
memory: "512Mi"
4062
cpu: "500m"
4163
livenessProbe:
4264
httpGet:

k8s/gateway/deployment.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,42 @@ spec:
1919
app.kubernetes.io/part-of: opentraum
2020
app.kubernetes.io/component: gateway
2121
spec:
22+
terminationGracePeriodSeconds: 35
23+
imagePullSecrets:
24+
- name: harbor-registry-secret
25+
securityContext:
26+
runAsNonRoot: true
27+
fsGroup: 1000
28+
topologySpreadConstraints:
29+
- maxSkew: 1
30+
topologyKey: kubernetes.io/hostname
31+
whenUnsatisfiable: ScheduleAnyway
32+
labelSelector:
33+
matchLabels:
34+
app.kubernetes.io/part-of: opentraum
2235
containers:
2336
- name: gateway
24-
image: opentraum/gateway:latest
37+
image: amdp-registry.skala-ai.com/skala26a-cloud/opentraum-gateway:latest
2538
ports:
2639
- containerPort: 8080
2740
protocol: TCP
41+
securityContext:
42+
runAsUser: 1000
43+
allowPrivilegeEscalation: false
2844
envFrom:
2945
- configMapRef:
3046
name: opentraum-config
47+
- secretRef:
48+
name: opentraum-secrets
49+
env:
50+
- name: JAVA_TOOL_OPTIONS
51+
value: "-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0"
3152
resources:
3253
requests:
33-
memory: "128Mi"
34-
cpu: "250m"
35-
limits:
3654
memory: "256Mi"
55+
cpu: "150m"
56+
limits:
57+
memory: "512Mi"
3758
cpu: "500m"
3859
livenessProbe:
3960
httpGet:

k8s/ingress.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,27 @@ metadata:
66
labels:
77
app.kubernetes.io/part-of: opentraum
88
annotations:
9-
nginx.ingress.kubernetes.io/rewrite-target: /
109
nginx.ingress.kubernetes.io/proxy-body-size: "10m"
1110
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"
12-
nginx.ingress.kubernetes.io/proxy-read-timeout: "60"
11+
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
1312
nginx.ingress.kubernetes.io/proxy-send-timeout: "60"
14-
nginx.ingress.kubernetes.io/rate-limit: "100"
15-
nginx.ingress.kubernetes.io/rate-limit-window: "1m"
1613
spec:
1714
ingressClassName: nginx
1815
rules:
19-
- host: api.opentraum.com
16+
- host: opentraum.52.79.80.47.nip.io
2017
http:
2118
paths:
22-
- path: /
19+
- path: /api
2320
pathType: Prefix
2421
backend:
2522
service:
2623
name: gateway
2724
port:
2825
number: 8080
26+
- path: /
27+
pathType: Prefix
28+
backend:
29+
service:
30+
name: web
31+
port:
32+
number: 80

k8s/kafka/service.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: opentraum-kafka
5+
namespace: opentraum
6+
labels:
7+
app: opentraum-kafka
8+
app.kubernetes.io/part-of: opentraum
9+
app.kubernetes.io/component: messaging
10+
spec:
11+
type: ClusterIP
12+
selector:
13+
app: opentraum-kafka
14+
ports:
15+
- name: client
16+
port: 9092
17+
targetPort: 9092
18+
protocol: TCP

k8s/kafka/statefulset.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
name: opentraum-kafka
5+
namespace: opentraum
6+
labels:
7+
app: opentraum-kafka
8+
app.kubernetes.io/part-of: opentraum
9+
app.kubernetes.io/component: messaging
10+
spec:
11+
serviceName: opentraum-kafka
12+
replicas: 1
13+
selector:
14+
matchLabels:
15+
app: opentraum-kafka
16+
template:
17+
metadata:
18+
labels:
19+
app: opentraum-kafka
20+
app.kubernetes.io/part-of: opentraum
21+
app.kubernetes.io/component: messaging
22+
spec:
23+
affinity:
24+
podAffinity:
25+
preferredDuringSchedulingIgnoredDuringExecution:
26+
- weight: 50
27+
podAffinityTerm:
28+
labelSelector:
29+
matchExpressions:
30+
- key: app.kubernetes.io/component
31+
operator: In
32+
values:
33+
- database
34+
- cache
35+
topologyKey: kubernetes.io/hostname
36+
containers:
37+
- name: kafka
38+
image: apache/kafka:3.7.0
39+
ports:
40+
- containerPort: 9092
41+
name: client
42+
protocol: TCP
43+
env:
44+
- name: KAFKA_NODE_ID
45+
value: "1"
46+
- name: KAFKA_PROCESS_ROLES
47+
value: "broker,controller"
48+
- name: KAFKA_CONTROLLER_QUORUM_VOTERS
49+
value: "1@localhost:9093"
50+
- name: KAFKA_LISTENERS
51+
value: "PLAINTEXT://:9092,CONTROLLER://:9093"
52+
- name: KAFKA_ADVERTISED_LISTENERS
53+
value: "PLAINTEXT://opentraum-kafka:9092"
54+
- name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
55+
value: "CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT"
56+
- name: KAFKA_CONTROLLER_LISTENER_NAMES
57+
value: "CONTROLLER"
58+
- name: KAFKA_INTER_BROKER_LISTENER_NAME
59+
value: "PLAINTEXT"
60+
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
61+
value: "1"
62+
- name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR
63+
value: "1"
64+
- name: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR
65+
value: "1"
66+
- name: KAFKA_AUTO_CREATE_TOPICS_ENABLE
67+
value: "true"
68+
- name: CLUSTER_ID
69+
value: "MkU3OEVBNTcwNTJENDM2Qk"
70+
resources:
71+
requests:
72+
memory: "384Mi"
73+
cpu: "200m"
74+
limits:
75+
memory: "512Mi"
76+
cpu: "500m"
77+
volumeMounts:
78+
- name: kafka-data
79+
mountPath: /tmp/kraft-combined-logs
80+
livenessProbe:
81+
tcpSocket:
82+
port: 9092
83+
initialDelaySeconds: 60
84+
periodSeconds: 15
85+
timeoutSeconds: 5
86+
failureThreshold: 3
87+
readinessProbe:
88+
tcpSocket:
89+
port: 9092
90+
initialDelaySeconds: 30
91+
periodSeconds: 10
92+
timeoutSeconds: 5
93+
failureThreshold: 3
94+
volumeClaimTemplates:
95+
- metadata:
96+
name: kafka-data
97+
spec:
98+
accessModes: ["ReadWriteOnce"]
99+
storageClassName: ebs-sc
100+
resources:
101+
requests:
102+
storage: 5Gi

0 commit comments

Comments
 (0)