From 2bb87b4474f137224d16e571cb394e2573bc6299 Mon Sep 17 00:00:00 2001 From: first-lounge Date: Thu, 12 Feb 2026 01:19:27 +0900 Subject: [PATCH 01/11] =?UTF-8?q?fix(#321):=20k8s=20=EB=B0=B0=ED=8F=AC=20?= =?UTF-8?q?=EC=8B=9C=20=EB=B0=9C=EC=83=9D=ED=95=98=EB=8A=94=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=20=EB=B3=80=EC=88=98=20=EB=AC=B8=EC=A0=9C=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=ED=95=98=EC=97=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connectors/register-connectors.sh | 23 +++++++- infra/k8s/base/kafka.yaml | 97 ------------------------------- 2 files changed, 20 insertions(+), 100 deletions(-) delete mode 100644 infra/k8s/base/kafka.yaml diff --git a/connectors/register-connectors.sh b/connectors/register-connectors.sh index 8049533b..7c4a201f 100644 --- a/connectors/register-connectors.sh +++ b/connectors/register-connectors.sh @@ -1,10 +1,27 @@ #!/bin/sh + +TARGET_URL=${CONNECT_URL:-"http://connect:8083"} + echo "Waiting for Kafka Connect..." -while [ $(curl -s -o /dev/null -w "%{http_code}" http://connect:8083) -ne 200 ]; do +while [ $(curl -s -o /dev/null -w "%{http_code}" $TARGET_URL) -ne 200 ]; do sleep 3 done echo "Registering connectors from /configs..." for file in /configs/*.json; do - curl -X POST -H "Content-Type: application/json" -d @"$file" http://connect:8083/connectors -done \ No newline at end of file + filename=$(basename "$file") + echo "Processing $filename..." + + sed -e "s|\${env:DB_HOST}|$DB_HOST|g" \ + -e "s|\${env:SPRING_DATASOURCE_USERNAME}|$SPRING_DATASOURCE_USERNAME|g" \ + -e "s|\${env:SPRING_DATASOURCE_PASSWORD}|$SPRING_DATASOURCE_PASSWORD|g" \ + -e "s|\${env:DB_NAME}|$DB_NAME|g" \ + "$file" > "/tmp/$filename" + + response=$(curl -s -X POST -H "Content-Type: application/json" \ + -d @"/tmp/$filename" \ + $TARGET_URL/connectors) + echo "Response for $filename: $response" +done + +echo "ALL connectors Created" \ No newline at end of file diff --git a/infra/k8s/base/kafka.yaml b/infra/k8s/base/kafka.yaml deleted file mode 100644 index 8ad08157..00000000 --- a/infra/k8s/base/kafka.yaml +++ /dev/null @@ -1,97 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: kafka-pvc - namespace: spot -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kafka - namespace: spot -spec: - replicas: 1 - selector: - matchLabels: - app: kafka - template: - metadata: - labels: - app: kafka - spec: - enableServiceLinks: false - containers: - - name: kafka - image: confluentinc/cp-kafka:7.5.0 - ports: - - containerPort: 9092 - - containerPort: 29092 - env: - - name: KAFKA_NODE_ID - value: "1" - - name: KAFKA_PROCESS_ROLES - value: "broker,controller" - - name: KAFKA_CONTROLLER_QUORUM_VOTERS - value: "1@localhost:19093" - - name: KAFKA_LISTENERS - value: "INTERNAL://0.0.0.0:29092,EXTERNAL://0.0.0.0:9092,CONTROLLER://0.0.0.0:19093" - - name: KAFKA_ADVERTISED_LISTENERS - value: "INTERNAL://kafka:29092,EXTERNAL://kafka:9092" - - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP - value: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT" - - name: KAFKA_INTER_BROKER_LISTENER_NAME - value: "INTERNAL" - - name: KAFKA_CONTROLLER_LISTENER_NAMES - value: "CONTROLLER" - - name: CLUSTER_ID - value: "J9Xz7kQPRYyK8VkqH3mW5A" - - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR - value: "1" - - name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR - value: "1" - - name: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR - value: "1" - - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE - value: "true" - - name: KAFKA_NUM_PARTITIONS - value: "3" - - name: KAFKA_HEAP_OPTS - value: "-Xmx512M -Xms512M" - - name: KAFKA_LOG4J_ROOT_LOGLEVEL - value: "WARN" - volumeMounts: - - name: kafka-storage - mountPath: /var/lib/kafka/data - resources: - requests: - memory: "512Mi" - cpu: "250m" - limits: - memory: "1Gi" - cpu: "500m" - volumes: - - name: kafka-storage - persistentVolumeClaim: - claimName: kafka-pvc ---- -apiVersion: v1 -kind: Service -metadata: - name: kafka - namespace: spot -spec: - selector: - app: kafka - ports: - - name: external - port: 9092 - targetPort: 9092 - - name: internal - port: 29092 - targetPort: 29092 \ No newline at end of file From 8ee891f00a22b06b8ac0c5c21f6148cb7a6aadc8 Mon Sep 17 00:00:00 2001 From: first-lounge Date: Thu, 12 Feb 2026 01:20:47 +0900 Subject: [PATCH 02/11] =?UTF-8?q?fix(#321):=20kafka-connect,=20kafka-conne?= =?UTF-8?q?ct-init,=20kafka-ui=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/k8s/base/kafka/kafka-connect-init.yaml | 35 +++++++ infra/k8s/base/kafka/kafka-connect.yaml | 61 ++++++++++++ infra/k8s/base/kafka/kafka-ui.yaml | 48 ++++++++++ infra/k8s/base/kafka/kafka.yaml | 98 ++++++++++++++++++++ infra/k8s/kustomization.yaml | 30 +++++- run_k3d.sh | 2 + 6 files changed, 271 insertions(+), 3 deletions(-) create mode 100644 infra/k8s/base/kafka/kafka-connect-init.yaml create mode 100644 infra/k8s/base/kafka/kafka-connect.yaml create mode 100644 infra/k8s/base/kafka/kafka-ui.yaml create mode 100644 infra/k8s/base/kafka/kafka.yaml diff --git a/infra/k8s/base/kafka/kafka-connect-init.yaml b/infra/k8s/base/kafka/kafka-connect-init.yaml new file mode 100644 index 00000000..d4eb3977 --- /dev/null +++ b/infra/k8s/base/kafka/kafka-connect-init.yaml @@ -0,0 +1,35 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: kafka-connect-init + namespace: spot +spec: + ttlSecondsAfterFinished: 60 # 해당 job 성공 후 60초 뒤에 pod 자동 삭제 + template: + spec: + restartPolicy: OnFailure + containers: + - name: kafka-connect-init + image: curlimages/curl:latest + env: + - name: CONNECT_URL + value: "http://kafka-connect-svc:8083" + envFrom: + - secretRef: + name: spot-secrets + command: ["/bin/sh"] + args: ["/configs/register-connectors.sh"] + volumeMounts: + - name: config-volume + mountPath: /configs + resources: + requests: + memory: "32Mi" + cpu: "10m" + limits: + memory: "64Mi" + cpu: "50m" + volumes: + - name: config-volume + configMap: + name: kafka-connect-init-config \ No newline at end of file diff --git a/infra/k8s/base/kafka/kafka-connect.yaml b/infra/k8s/base/kafka/kafka-connect.yaml new file mode 100644 index 00000000..87684cc8 --- /dev/null +++ b/infra/k8s/base/kafka/kafka-connect.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-connect + namespace: spot +spec: + replicas: 1 + selector: + matchLabels: + app: kafka-connect + template: + metadata: + labels: + app: kafka-connect + spec: + containers: + - name: kafka-connect + image: quay.io/debezium/connect:3.4.0.Final + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8083 + env: + - name: CONNECT_CONFIG_PROVIDERS + value: 'env' + - name: CONNECT_CONFIG_PROVIDERS_ENV_CLASS + value: 'org.apache.kafka.common.config.provider.EnvVarConfigProvider' + - name: CONNECT_BOOTSTRAP_SERVERS + value: kafka:9092 + - name: GROUP_ID + value: "1" + - name: CONFIG_STORAGE_TOPIC + value: my_connect_configs + - name: OFFSET_STORAGE_TOPIC + value: my_connect_offsets + - name: STATUS_STORAGE_TOPIC + value: my_connect_statuses + - name: KEY_CONVERTER + value: org.apache.kafka.connect.json.JsonConverter + - name: VALUE_CONVERTER + value: org.apache.kafka.connect.json.JsonConverter + - name: CONNECT_KEY_CONVERTER_SCHEMAS_ENABLE + value: "false" + - name: CONNECT_VALUE_CONVERTER_SCHEMAS_ENABLE + value: "false" + - name: LOGGING_LEVEL + value: 'WARN' + - name: CONNECT_LOG4J_LOGGERS + value: "org.apache.kafka.connect.runtime.rest=WARN,org.reflections=ERROR" +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka-connect-svc + namespace: spot +spec: + type: ClusterIP + selector: + app: kafka-connect + ports: + - port: 8083 + targetPort: 8083 \ No newline at end of file diff --git a/infra/k8s/base/kafka/kafka-ui.yaml b/infra/k8s/base/kafka/kafka-ui.yaml new file mode 100644 index 00000000..c5a4d6ee --- /dev/null +++ b/infra/k8s/base/kafka/kafka-ui.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-ui + namespace: spot +spec: + replicas: 1 + selector: + matchLabels: + app: kafka-ui + template: + metadata: + labels: + app: kafka-ui + spec: + containers: + - name: kafka-ui + image: provectuslabs/kafka-ui:latest + ports: + - containerPort: 8080 + env: + - name: SERVER_SERVLET_CONTEXT_PATH + value: '/kafka-ui' + - name: KAFKA_CLUSTERS_0_NAME + value: local-spot-cluster + - name: KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS + value: 'kafka:9092' + - name: KAFKA_CLUSTERS_0_KAFKACONNECT_0_NAME + value: connect + - name: KAFKA_CLUSTERS_0_KAFKACONNECT_0_ADDRESS + value: 'http://kafka-connect-svc:8083' + - name: LOGGING_LEVEL_ROOT + value: WARN + - name: LOGGING_LEVEL_COM_PROVECTUS + value: WARN +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka-ui-svc + namespace: spot +spec: + type: ClusterIP + selector: + app: kafka-ui + ports: + - port: 80 + targetPort: 8080 \ No newline at end of file diff --git a/infra/k8s/base/kafka/kafka.yaml b/infra/k8s/base/kafka/kafka.yaml new file mode 100644 index 00000000..800b81ae --- /dev/null +++ b/infra/k8s/base/kafka/kafka.yaml @@ -0,0 +1,98 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: kafka-pvc + namespace: spot +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka + namespace: spot +spec: + replicas: 1 + selector: + matchLabels: + app: kafka + template: + metadata: + labels: + app: kafka + spec: + enableServiceLinks: false + containers: + - name: kafka + image: apache/kafka:4.0.0 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 9092 + - containerPort: 29092 + env: + - name: KAFKA_NODE_ID + value: "1" + - name: KAFKA_PROCESS_ROLES + value: "broker,controller" + - name: KAFKA_CONTROLLER_QUORUM_VOTERS + value: "1@localhost:19093" + - name: KAFKA_LISTENERS + value: "INTERNAL://0.0.0.0:29092,EXTERNAL://0.0.0.0:9092,CONTROLLER://0.0.0.0:19093" + - name: KAFKA_ADVERTISED_LISTENERS + value: "INTERNAL://kafka:29092,EXTERNAL://kafka:9092" + - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP + value: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT" + - name: KAFKA_INTER_BROKER_LISTENER_NAME + value: "INTERNAL" + - name: KAFKA_CONTROLLER_LISTENER_NAMES + value: "CONTROLLER" + - name: CLUSTER_ID + value: "J9Xz7kQPRYyK8VkqH3mW5A" + - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR + value: "1" + - name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR + value: "1" + - name: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR + value: "1" + - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE + value: "true" + - name: KAFKA_NUM_PARTITIONS + value: "3" + - name: KAFKA_HEAP_OPTS + value: "-Xmx512M -Xms512M" + - name: KAFKA_LOG4J_ROOT_LOGLEVEL + value: "WARN" + volumeMounts: + - name: kafka-storage + mountPath: /var/lib/kafka/data + resources: + requests: + memory: "512Mi" + cpu: "250m" + limits: + memory: "1Gi" + cpu: "500m" + volumes: + - name: kafka-storage + persistentVolumeClaim: + claimName: kafka-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka + namespace: spot +spec: + selector: + app: kafka + ports: + - name: external + port: 9092 + targetPort: 9092 + - name: internal + port: 29092 + targetPort: 29092 \ No newline at end of file diff --git a/infra/k8s/kustomization.yaml b/infra/k8s/kustomization.yaml index 19a9af61..20282824 100644 --- a/infra/k8s/kustomization.yaml +++ b/infra/k8s/kustomization.yaml @@ -4,23 +4,37 @@ kind: Kustomization # namespace: spot 제거 - 각 리소스가 자체 네임스페이스 유지 resources: + # Base - base/namespace.yaml - base/configmap.yaml - base/postgres.yaml - base/redis.yaml - - base/kafka.yaml + + # Kafka + - base/kafka/kafka.yaml + - base/kafka/kafka-connect.yaml + - base/kafka/kafka-connect-init.yaml + - base/kafka/kafka-ui.yaml + + # Monitoring & Logging - base/monitoring/loki/loki.yaml - base/monitoring/loki/loki-config.yaml - base/monitoring/monitoring-ingress.yaml - - base/monitoring/grafana/grafana.yaml - - base/monitoring/grafana/grafana-config.yaml - base/monitoring/fluent-bit/fluent-bit.yaml - base/monitoring/fluent-bit/fluent-bit-config.yaml + + # Grafana + - base/monitoring/grafana/grafana.yaml + - base/monitoring/grafana/grafana-config.yaml + + # Spot Monitoring - base/monitoring/servicemonitors/spot-gateway-servicemonitor.yaml - base/monitoring/servicemonitors/spot-user-servicemonitor.yaml - base/monitoring/servicemonitors/spot-order-servicemonitor.yaml - base/monitoring/servicemonitors/spot-store-servicemonitor.yaml - base/monitoring/servicemonitors/spot-payment-servicemonitor.yaml + + # Spot Apps - apps/spot-ingress.yaml - apps/spot-gateway.yaml - apps/spot-user.yaml @@ -42,6 +56,16 @@ configMapGenerator: - ../../config/spot-payment.yml options: disableNameSuffixHash: true + + - name: kafka-connect-init-config + namespace: spot + files: + - ../../connectors/order-outbox.json + - ../../connectors/payment-outbox.json + - ../../connectors/register-connectors.sh + options: + disableNameSuffixHash: true + - name: grafana-dashboards-spot namespace: monitoring files: diff --git a/run_k3d.sh b/run_k3d.sh index 33424a67..20ca930d 100755 --- a/run_k3d.sh +++ b/run_k3d.sh @@ -162,6 +162,8 @@ deploy_all() { kubectl wait --for=condition=available deployment/postgres -n spot --timeout=180s kubectl wait --for=condition=available deployment/redis -n spot --timeout=180s kubectl wait --for=condition=available deployment/kafka -n spot --timeout=180s + kubectl wait --for=condition=available deployment/kafka-connect -n spot --timeout=180s + kubectl wait --for=condition=available deployment/kafka-ui -n spot --timeout=180s log_info "Infrastructure deployed successfully!" From bbba917f0e5a6092e52602913b2035755f13e763 Mon Sep 17 00:00:00 2001 From: first-lounge Date: Thu, 12 Feb 2026 01:21:29 +0900 Subject: [PATCH 03/11] =?UTF-8?q?fix(#321):=20kafka-ui=20URL=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/k8s/apps/spot-ingress.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/infra/k8s/apps/spot-ingress.yaml b/infra/k8s/apps/spot-ingress.yaml index 303351d0..d9477dc4 100644 --- a/infra/k8s/apps/spot-ingress.yaml +++ b/infra/k8s/apps/spot-ingress.yaml @@ -19,3 +19,10 @@ spec: name: spot-gateway port: number: 80 + - path: /kafka-ui + pathType: Prefix + backend: + service: + name: kafka-ui-svc + port: + number: 80 \ No newline at end of file From 24963544ce165be8803a38f5ed2be2e0e83bf8ed Mon Sep 17 00:00:00 2001 From: first-lounge Date: Thu, 12 Feb 2026 01:22:01 +0900 Subject: [PATCH 04/11] =?UTF-8?q?fix(#321):=20.env=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index a282fee4..8cacdc12 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -93,6 +93,8 @@ services: connect-init: image: curlimages/curl:latest container_name: connect-init + env_file: + - .env depends_on: - connect networks: @@ -118,6 +120,7 @@ services: networks: - spot-network +# --- Temporal 1--- temporal: container_name: temporal image: temporalio/auto-setup:1.29.3 From 59687aff19ac8ca74e9280d3e9b83f153b797453 Mon Sep 17 00:00:00 2001 From: first-lounge Date: Thu, 12 Feb 2026 16:21:52 +0900 Subject: [PATCH 05/11] =?UTF-8?q?feat(#321):=20temporal=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/k8s/base/temporal/temporal-ui.yaml | 38 ++++++++++++++ infra/k8s/base/temporal/temporal.yaml | 67 ++++++++++++++++++++++++ infra/k8s/kustomization.yaml | 4 ++ run_k3d.sh | 2 + 4 files changed, 111 insertions(+) create mode 100644 infra/k8s/base/temporal/temporal-ui.yaml create mode 100644 infra/k8s/base/temporal/temporal.yaml diff --git a/infra/k8s/base/temporal/temporal-ui.yaml b/infra/k8s/base/temporal/temporal-ui.yaml new file mode 100644 index 00000000..e90b33dc --- /dev/null +++ b/infra/k8s/base/temporal/temporal-ui.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: temporal-ui + namespace: spot +spec: + replicas: 1 + selector: + matchLabels: + app: temporal-ui + template: + metadata: + labels: + app: temporal-ui + spec: + containers: + - name: temporal-ui + image: temporalio/ui:latest + ports: + - containerPort: 8080 + env: + - name: TEMPORAL_ADDRESS + value: "temporal-svc:7233" + - name: TEMPORAL_CORS_ALLOW_ORIGINS + value: "*" +--- +apiVersion: v1 +kind: Service +metadata: + name: temporal-ui-svc + namespace: spot +spec: + type: ClusterIP + selector: + app: temporal-ui + ports: + - port: 80 + targetPort: 8080 \ No newline at end of file diff --git a/infra/k8s/base/temporal/temporal.yaml b/infra/k8s/base/temporal/temporal.yaml new file mode 100644 index 00000000..5c5194e9 --- /dev/null +++ b/infra/k8s/base/temporal/temporal.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: temporal + namespace: spot +spec: + replicas: 1 + selector: + matchLabels: + app: temporal + template: + metadata: + labels: + app: temporal + spec: + containers: + - name: temporal + image: temporalio/auto-setup:1.29.3 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 7233 + env: + - name: DB + value: postgres12 + - name: POSTGRES_SEEDS + value: postgres + - name: DB_PORT + value: "5432" + - name: POSTGRES_USER + value: "admin" + - name: POSTGRES_PWD + valueFrom: + secretKeyRef: + name: spot-secrets + key: SPRING_DATASOURCE_PASSWORD + - name: DBNAME + value: "spot_temporal" + - name: VISIBILITY_DBNAME + value: "spot_visibility" + - name: SKIP_SCHEMA_SETUP + value: "false" + - name: ENABLE_ES + value: "false" + - name: SKIP_DEFAULT_NAMESPACE_CREATION + value: "false" + - name: LOG_LEVEL + value: "warn" + resources: + requests: + memory: "256Mi" + cpu: "250m" + limits: + memory: "512Mi" + cpu: "500m" +--- +apiVersion: v1 +kind: Service +metadata: + name: temporal-svc + namespace: spot +spec: + type: ClusterIP + selector: + app: temporal + ports: + - port: 7233 + targetPort: 7233 diff --git a/infra/k8s/kustomization.yaml b/infra/k8s/kustomization.yaml index 20282824..82758521 100644 --- a/infra/k8s/kustomization.yaml +++ b/infra/k8s/kustomization.yaml @@ -16,6 +16,10 @@ resources: - base/kafka/kafka-connect-init.yaml - base/kafka/kafka-ui.yaml + # temporal + - base/temporal/temporal.yaml + - base/temporal/temporal-ui.yaml + # Monitoring & Logging - base/monitoring/loki/loki.yaml - base/monitoring/loki/loki-config.yaml diff --git a/run_k3d.sh b/run_k3d.sh index 20ca930d..be6b3f81 100755 --- a/run_k3d.sh +++ b/run_k3d.sh @@ -164,6 +164,8 @@ deploy_all() { kubectl wait --for=condition=available deployment/kafka -n spot --timeout=180s kubectl wait --for=condition=available deployment/kafka-connect -n spot --timeout=180s kubectl wait --for=condition=available deployment/kafka-ui -n spot --timeout=180s + kubectl wait --for=condition=available deployment/temporal -n spot --timeout=180s + kubectl wait --for=condition=available deployment/temporal-ui -n spot --timeout=180s log_info "Infrastructure deployed successfully!" From fde821addbc70d837170071919f9eee3282fec6f Mon Sep 17 00:00:00 2001 From: first-lounge Date: Thu, 12 Feb 2026 16:29:24 +0900 Subject: [PATCH 06/11] =?UTF-8?q?fix(#321):=20kafak=20ui=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yaml | 10 +++++----- infra/k8s/apps/spot-ingress.yaml | 20 ++++++++++++++++++-- infra/k8s/base/kafka/kafka-ui.yaml | 2 -- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 8cacdc12..1891a746 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -120,11 +120,11 @@ services: networks: - spot-network -# --- Temporal 1--- +# --- Temporal --- temporal: container_name: temporal image: temporalio/auto-setup:1.29.3 - ports: + ports: - "7233:7233" environment: - DB=postgres12 @@ -142,8 +142,8 @@ services: - db networks: - spot-network - - + + temporal-ui: container_name: temporal-ui image: temporalio/ui:latest @@ -156,7 +156,7 @@ services: - temporal networks: - spot-network - + # --- Application Services --- spot-gateway: build: diff --git a/infra/k8s/apps/spot-ingress.yaml b/infra/k8s/apps/spot-ingress.yaml index d9477dc4..625eb8da 100644 --- a/infra/k8s/apps/spot-ingress.yaml +++ b/infra/k8s/apps/spot-ingress.yaml @@ -5,7 +5,6 @@ metadata: namespace: spot annotations: kubernetes.io/ingress.class: nginx -# nginx.ingress.kubernetes.io/rewrite-target: /$1 # 첫 번째 prefix 제거 spec: ingressClassName: nginx rules: @@ -19,10 +18,27 @@ spec: name: spot-gateway port: number: 80 - - path: /kafka-ui + + # kafka + - host: kafka.localhost + http: + paths: + - path: / pathType: Prefix backend: service: name: kafka-ui-svc + port: + number: 80 + + # temporal + - host: temporal.localhost + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: temporal-ui-svc port: number: 80 \ No newline at end of file diff --git a/infra/k8s/base/kafka/kafka-ui.yaml b/infra/k8s/base/kafka/kafka-ui.yaml index c5a4d6ee..f394d3be 100644 --- a/infra/k8s/base/kafka/kafka-ui.yaml +++ b/infra/k8s/base/kafka/kafka-ui.yaml @@ -19,8 +19,6 @@ spec: ports: - containerPort: 8080 env: - - name: SERVER_SERVLET_CONTEXT_PATH - value: '/kafka-ui' - name: KAFKA_CLUSTERS_0_NAME value: local-spot-cluster - name: KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS From 5b031c1bb2c184d4c0c1cf2c4291c999b4c1611f Mon Sep 17 00:00:00 2001 From: first-lounge Date: Sun, 15 Feb 2026 00:48:58 +0900 Subject: [PATCH 07/11] =?UTF-8?q?fix(#332):=20temporal=20=EC=A3=BC?= =?UTF-8?q?=EC=86=8C=20=EB=B0=8F=20=EB=A6=AC=EC=86=8C=EC=8A=A4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95,=20=EC=B9=B4=ED=94=84=EC=B9=B4=20=EB=A6=AC=EC=86=8C?= =?UTF-8?q?=EC=8A=A4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/eks/aws-ingress.yaml | 48 + infra/eks/kafka/kafka-connect-init.yaml | 35 + infra/eks/kafka/kafka-connect.yaml | 68 + infra/eks/kafka/kafka-ui.yaml | 53 + infra/eks/kafka/kafka.yaml | 98 + .../fluent-bit/fluent-bit-config.yaml | 101 + .../eks/monitoring/fluent-bit/fluent-bit.yaml | 109 + .../monitoring/grafana/dashboards/15661.json | 6708 +++++++++++++++++ .../monitoring/grafana/dashboards/15757.json | 1 + .../monitoring/grafana/dashboards/15760.json | 3025 ++++++++ .../monitoring/grafana/dashboards/9578.json | 3543 +++++++++ .../grafana/dashboards/spot-logs.json | 20 + .../monitoring/grafana/grafana-config.yaml | 48 + infra/eks/monitoring/grafana/grafana.yaml | 132 + infra/eks/monitoring/loki/loki-config.yaml | 47 + infra/eks/monitoring/loki/loki.yaml | 72 + infra/eks/monitoring/monitoring-ingress.yaml | 21 + infra/eks/monitoring/prometheus/value.yaml | 27 + .../spot-gateway-servicemonitor.yaml | 18 + .../spot-order-servicemonitor.yaml | 17 + .../spot-payment-servicemonitor.yaml | 17 + .../spot-store-servicemonitor.yaml | 17 + .../spot-user-servicemonitor.yaml | 17 + infra/eks/spot/postgres.yaml | 69 + infra/eks/spot/redis.yaml | 39 + infra/eks/spot/spot-gateway.yaml | 78 + infra/eks/spot/spot-order.yaml | 73 + infra/eks/spot/spot-payment.yaml | 73 + infra/eks/spot/spot-store.yaml | 73 + infra/eks/spot/spot-user.yaml | 73 + infra/eks/temporal/temporal-ui.yaml | 45 + infra/eks/temporal/temporal.yaml | 67 + infra/k8s/base/kafka/kafka-connect.yaml | 7 + infra/k8s/base/kafka/kafka-ui.yaml | 7 + infra/k8s/base/temporal/temporal-ui.yaml | 9 +- infra/k8s/base/temporal/temporal.yaml | 6 +- infra/spot-chart/templates/deployment.yaml | 68 + infra/spot-chart/templates/ingress.yaml | 23 + 38 files changed, 14948 insertions(+), 4 deletions(-) create mode 100644 infra/eks/aws-ingress.yaml create mode 100644 infra/eks/kafka/kafka-connect-init.yaml create mode 100644 infra/eks/kafka/kafka-connect.yaml create mode 100644 infra/eks/kafka/kafka-ui.yaml create mode 100644 infra/eks/kafka/kafka.yaml create mode 100644 infra/eks/monitoring/fluent-bit/fluent-bit-config.yaml create mode 100644 infra/eks/monitoring/fluent-bit/fluent-bit.yaml create mode 100644 infra/eks/monitoring/grafana/dashboards/15661.json create mode 100644 infra/eks/monitoring/grafana/dashboards/15757.json create mode 100644 infra/eks/monitoring/grafana/dashboards/15760.json create mode 100644 infra/eks/monitoring/grafana/dashboards/9578.json create mode 100644 infra/eks/monitoring/grafana/dashboards/spot-logs.json create mode 100644 infra/eks/monitoring/grafana/grafana-config.yaml create mode 100644 infra/eks/monitoring/grafana/grafana.yaml create mode 100644 infra/eks/monitoring/loki/loki-config.yaml create mode 100644 infra/eks/monitoring/loki/loki.yaml create mode 100644 infra/eks/monitoring/monitoring-ingress.yaml create mode 100644 infra/eks/monitoring/prometheus/value.yaml create mode 100644 infra/eks/monitoring/servicemonitors/spot-gateway-servicemonitor.yaml create mode 100644 infra/eks/monitoring/servicemonitors/spot-order-servicemonitor.yaml create mode 100644 infra/eks/monitoring/servicemonitors/spot-payment-servicemonitor.yaml create mode 100644 infra/eks/monitoring/servicemonitors/spot-store-servicemonitor.yaml create mode 100644 infra/eks/monitoring/servicemonitors/spot-user-servicemonitor.yaml create mode 100644 infra/eks/spot/postgres.yaml create mode 100644 infra/eks/spot/redis.yaml create mode 100644 infra/eks/spot/spot-gateway.yaml create mode 100644 infra/eks/spot/spot-order.yaml create mode 100644 infra/eks/spot/spot-payment.yaml create mode 100644 infra/eks/spot/spot-store.yaml create mode 100644 infra/eks/spot/spot-user.yaml create mode 100644 infra/eks/temporal/temporal-ui.yaml create mode 100644 infra/eks/temporal/temporal.yaml create mode 100644 infra/spot-chart/templates/deployment.yaml create mode 100644 infra/spot-chart/templates/ingress.yaml diff --git a/infra/eks/aws-ingress.yaml b/infra/eks/aws-ingress.yaml new file mode 100644 index 00000000..b9c9a306 --- /dev/null +++ b/infra/eks/aws-ingress.yaml @@ -0,0 +1,48 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: aws-ingress + namespace: spot + annotations: + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/target-type: ip # IP 모드 + alb.ingress.kubernetes.io/healthcheck-path: /actuator/health + alb.ingress.kubernetes.io/success-codes: "200" # 헬스 체크 성공 코드 +spec: + ingressClassName: alb + rules: + # spot + - host: spotorder.org + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: spot-gateway + port: + number: 80 +# +# # kafka +# - host: kafka.localhost +# http: +# paths: +# - path: / +# pathType: Prefix +# backend: +# service: +# name: kafka-ui-svc +# port: +# number: 80 +# +# # temporal +# - host: temporal.localhost +# http: +# paths: +# - path: / +# pathType: Prefix +# backend: +# service: +# name: temporal-ui-svc +# port: +# number: 80 \ No newline at end of file diff --git a/infra/eks/kafka/kafka-connect-init.yaml b/infra/eks/kafka/kafka-connect-init.yaml new file mode 100644 index 00000000..d4eb3977 --- /dev/null +++ b/infra/eks/kafka/kafka-connect-init.yaml @@ -0,0 +1,35 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: kafka-connect-init + namespace: spot +spec: + ttlSecondsAfterFinished: 60 # 해당 job 성공 후 60초 뒤에 pod 자동 삭제 + template: + spec: + restartPolicy: OnFailure + containers: + - name: kafka-connect-init + image: curlimages/curl:latest + env: + - name: CONNECT_URL + value: "http://kafka-connect-svc:8083" + envFrom: + - secretRef: + name: spot-secrets + command: ["/bin/sh"] + args: ["/configs/register-connectors.sh"] + volumeMounts: + - name: config-volume + mountPath: /configs + resources: + requests: + memory: "32Mi" + cpu: "10m" + limits: + memory: "64Mi" + cpu: "50m" + volumes: + - name: config-volume + configMap: + name: kafka-connect-init-config \ No newline at end of file diff --git a/infra/eks/kafka/kafka-connect.yaml b/infra/eks/kafka/kafka-connect.yaml new file mode 100644 index 00000000..87f2e608 --- /dev/null +++ b/infra/eks/kafka/kafka-connect.yaml @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-connect + namespace: spot +spec: + replicas: 1 + selector: + matchLabels: + app: kafka-connect + template: + metadata: + labels: + app: kafka-connect + spec: + containers: + - name: kafka-connect + image: quay.io/debezium/connect:3.4.0.Final + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8083 + env: + - name: CONNECT_CONFIG_PROVIDERS + value: 'env' + - name: CONNECT_CONFIG_PROVIDERS_ENV_CLASS + value: 'org.apache.kafka.common.config.provider.EnvVarConfigProvider' + - name: CONNECT_BOOTSTRAP_SERVERS + value: kafka:9092 + - name: GROUP_ID + value: "1" + - name: CONFIG_STORAGE_TOPIC + value: my_connect_configs + - name: OFFSET_STORAGE_TOPIC + value: my_connect_offsets + - name: STATUS_STORAGE_TOPIC + value: my_connect_statuses + - name: KEY_CONVERTER + value: org.apache.kafka.connect.json.JsonConverter + - name: VALUE_CONVERTER + value: org.apache.kafka.connect.json.JsonConverter + - name: CONNECT_KEY_CONVERTER_SCHEMAS_ENABLE + value: "false" + - name: CONNECT_VALUE_CONVERTER_SCHEMAS_ENABLE + value: "false" + - name: LOGGING_LEVEL + value: 'WARN' + - name: CONNECT_LOG4J_LOGGERS + value: "org.apache.kafka.connect.runtime.rest=WARN,org.reflections=ERROR" + resources: + requests: + cpu: "250m" + memory: "512Mi" + limits: + cpu: "750m" + memory: "1Gi" +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka-connect-svc + namespace: spot +spec: + type: ClusterIP + selector: + app: kafka-connect + ports: + - port: 8083 + targetPort: 8083 \ No newline at end of file diff --git a/infra/eks/kafka/kafka-ui.yaml b/infra/eks/kafka/kafka-ui.yaml new file mode 100644 index 00000000..4ec8239a --- /dev/null +++ b/infra/eks/kafka/kafka-ui.yaml @@ -0,0 +1,53 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka-ui + namespace: spot +spec: + replicas: 1 + selector: + matchLabels: + app: kafka-ui + template: + metadata: + labels: + app: kafka-ui + spec: + containers: + - name: kafka-ui + image: provectuslabs/kafka-ui:latest + ports: + - containerPort: 8080 + env: + - name: KAFKA_CLUSTERS_0_NAME + value: local-spot-cluster + - name: KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS + value: 'kafka:9092' + - name: KAFKA_CLUSTERS_0_KAFKACONNECT_0_NAME + value: connect + - name: KAFKA_CLUSTERS_0_KAFKACONNECT_0_ADDRESS + value: 'http://kafka-connect-svc:8083' + - name: LOGGING_LEVEL_ROOT + value: WARN + - name: LOGGING_LEVEL_COM_PROVECTUS + value: WARN + resources: + requests: + cpu: "250m" + memory: "256Mi" + limits: + cpu: "500m" + memory: "512Mi" +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka-ui-svc + namespace: spot +spec: + type: ClusterIP + selector: + app: kafka-ui + ports: + - port: 80 + targetPort: 8080 \ No newline at end of file diff --git a/infra/eks/kafka/kafka.yaml b/infra/eks/kafka/kafka.yaml new file mode 100644 index 00000000..800b81ae --- /dev/null +++ b/infra/eks/kafka/kafka.yaml @@ -0,0 +1,98 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: kafka-pvc + namespace: spot +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: kafka + namespace: spot +spec: + replicas: 1 + selector: + matchLabels: + app: kafka + template: + metadata: + labels: + app: kafka + spec: + enableServiceLinks: false + containers: + - name: kafka + image: apache/kafka:4.0.0 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 9092 + - containerPort: 29092 + env: + - name: KAFKA_NODE_ID + value: "1" + - name: KAFKA_PROCESS_ROLES + value: "broker,controller" + - name: KAFKA_CONTROLLER_QUORUM_VOTERS + value: "1@localhost:19093" + - name: KAFKA_LISTENERS + value: "INTERNAL://0.0.0.0:29092,EXTERNAL://0.0.0.0:9092,CONTROLLER://0.0.0.0:19093" + - name: KAFKA_ADVERTISED_LISTENERS + value: "INTERNAL://kafka:29092,EXTERNAL://kafka:9092" + - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP + value: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT" + - name: KAFKA_INTER_BROKER_LISTENER_NAME + value: "INTERNAL" + - name: KAFKA_CONTROLLER_LISTENER_NAMES + value: "CONTROLLER" + - name: CLUSTER_ID + value: "J9Xz7kQPRYyK8VkqH3mW5A" + - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR + value: "1" + - name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR + value: "1" + - name: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR + value: "1" + - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE + value: "true" + - name: KAFKA_NUM_PARTITIONS + value: "3" + - name: KAFKA_HEAP_OPTS + value: "-Xmx512M -Xms512M" + - name: KAFKA_LOG4J_ROOT_LOGLEVEL + value: "WARN" + volumeMounts: + - name: kafka-storage + mountPath: /var/lib/kafka/data + resources: + requests: + memory: "512Mi" + cpu: "250m" + limits: + memory: "1Gi" + cpu: "500m" + volumes: + - name: kafka-storage + persistentVolumeClaim: + claimName: kafka-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: kafka + namespace: spot +spec: + selector: + app: kafka + ports: + - name: external + port: 9092 + targetPort: 9092 + - name: internal + port: 29092 + targetPort: 29092 \ No newline at end of file diff --git a/infra/eks/monitoring/fluent-bit/fluent-bit-config.yaml b/infra/eks/monitoring/fluent-bit/fluent-bit-config.yaml new file mode 100644 index 00000000..697237b1 --- /dev/null +++ b/infra/eks/monitoring/fluent-bit/fluent-bit-config.yaml @@ -0,0 +1,101 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: fluent-bit-config + namespace: monitoring +data: + fluent-bit.conf: |- + [SERVICE] + Flush 1 + Daemon Off + Log_Level info + Parsers_File parsers.conf + + [INPUT] + Name tail + Tag kube.* + Path /var/log/containers/*.log + Parser cri + DB /fluent-bit/tail/flb_kube.db + Mem_Buf_Limit 50MB + Skip_Long_Lines On + Refresh_Interval 10 + + Read_from_Head Off + Ignore_Older 10m + + + [FILTER] + Name kubernetes + Match kube.* + Kube_Tag_Prefix kube.var.log.containers. + Kube_URL https://kubernetes.default.svc:443 + Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt + Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token + Merge_Log On + Merge_Log_Key log_processed + Keep_Log Off + Labels On + + [FILTER] + Name parser + Match kube.* + Key_Name log_processed + Parser json + Reserve_Data On + + + + # 사용하지 않는 로그제거 + [FILTER] + Name grep + Match kube.* + Exclude log .*\/actuator\/(health|readiness|liveness).* + + [FILTER] + Name grep + Match kube.* + Exclude $kubernetes['namespace_name'] kube-system + [FILTER] + Name grep + Match kube.* + Exclude $kubernetes['namespace_name'] monitoring + + + + [OUTPUT] + Name loki + Match kube.* + Host loki-service.monitoring.svc.cluster.local + Port 3100 + Uri /loki/api/v1/push + + labels job=fluent-bit + label_keys $kubernetes['labels']['app'],$kubernetes['namespace_name'],$kubernetes['container_name'] + line_format json + + workers 1 + Retry_Limit 5 + net.keepalive on + net.keepalive_idle_timeout 10 + + + [OUTPUT] + Name stdout + Match kube.* + Format json_lines + + + parsers.conf: |- + [PARSER] + Name cri + Format regex + Regex ^(?