This commit is contained in:
hiondal
2025-06-15 18:44:40 +00:00
parent 64e2b90024
commit 67d4d69bc4
7 changed files with 319 additions and 86 deletions
@@ -62,6 +62,12 @@ data:
# 🔧 Poetry 캐시 설정
POETRY_CACHE_DIR: "/home/appuser/.cache/pypoetry/cache"
POETRY_VENV_PATH: "/home/appuser/.cache/pypoetry/venvs"
POETRY_CONFIG_DIR: "/home/appuser/.config/pypoetry"
POETRY_DATA_DIR: "/home/appuser/.local/share/pypoetry"
POETRY_NO_INTERACTION: "1"
POETRY_VENV_IN_PROJECT: "false"
POETRY_VIRTUALENVS_CREATE: "true"
# 🔧 FastAPI 설정
FASTAPI_ENV: "production"
+66 -8
View File
@@ -1,4 +1,4 @@
# deployment/manifests/deployment.yaml - 간소화된 버전 (initContainer 제거)
# deployment/manifests/deployment.yaml - initContainer로 권한 문제 해결
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -8,7 +8,7 @@ metadata:
version: v1.0.0
annotations:
deployment.kubernetes.io/revision: "1"
description: "Vector DB API with Simplified Home Directory Structure"
description: "Vector DB API with initContainer Permission Fix"
spec:
replicas: 1
strategy:
@@ -29,8 +29,53 @@ spec:
prometheus.io/port: "8000"
prometheus.io/path: "/metrics"
spec:
# 🚫 initContainer 제거 - 홈 디렉토리 사용으로 불필요
# 🚀 initContainer로 Poetry 설정 파일 생성 (볼륨에)
initContainers:
- name: setup-poetry-config
image: busybox:1.35
command:
- /bin/sh
- -c
- |
echo "🔧 Poetry 설정 생성 중... (볼륨 기반)"
# 볼륨 마운트된 경로에 Poetry 설정 생성
mkdir -p /cache/poetry-config
mkdir -p /cache/poetry-data
# Poetry 설정 파일을 볼륨에 생성
cat > /cache/poetry-config/config.toml << 'EOF'
[virtualenvs]
create = true
in-project = false
path = "/home/appuser/.cache/pypoetry/venvs"
[cache-dir]
path = "/home/appuser/.cache/pypoetry/cache"
[installer]
no-cache = false
EOF
echo "✅ Poetry 설정 생성 완료!"
echo "📝 설정 파일 내용:"
cat /cache/poetry-config/config.toml
echo "📁 캐시 디렉토리:"
ls -la /cache/
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
capabilities:
drop:
- ALL
volumeMounts:
- name: cache-volume
mountPath: /cache
containers:
- name: vector-api
image: acrdigitalgarage03.azurecr.io/vector-api:latest
@@ -97,15 +142,14 @@ spec:
failureThreshold: 30 # 최대 5분 대기
successThreshold: 1
# 📂 볼륨 마운트 (홈 디렉토리 기반)
# 📂 볼륨 마운트 (홈 디렉토리 기반 + Poetry 설정)
volumeMounts:
- name: vector-db-storage
mountPath: /home/appuser/vectordb # ✅ PVC 마운트
- name: tmp-volume
mountPath: /tmp
- name: cache-volume
mountPath: /home/appuser/.cache
subPath: "vector-api"
mountPath: /home/appuser/.cache # 전체 캐시 디렉토리
# 🌍 환경변수 설정 - ConfigMap에서 모든 값 가져오기
envFrom:
@@ -120,13 +164,27 @@ spec:
name: vector-api-secret
key: CLAUDE_API_KEY
# 🔧 런타임 환경변수
# 🔧 런타임 환경변수 (Poetry 설정을 볼륨으로 이동)
- name: PYTHONPATH
value: "/home/appuser"
- name: HOME
value: "/home/appuser"
- name: USER
value: "appuser"
- name: POETRY_CONFIG_DIR
value: "/home/appuser/.cache/poetry-config" # 볼륨 마운트된 경로로 변경
- name: POETRY_DATA_DIR
value: "/home/appuser/.cache/poetry-data" # 볼륨 마운트된 경로로 변경
- name: POETRY_CACHE_DIR
value: "/home/appuser/.cache/pypoetry/cache"
- name: POETRY_VENV_PATH
value: "/home/appuser/.cache/pypoetry/venvs"
- name: POETRY_NO_INTERACTION
value: "1"
- name: POETRY_VIRTUALENVS_CREATE
value: "true"
- name: POETRY_VIRTUALENVS_IN_PROJECT
value: "false"
# 🔧 성능 최적화 환경변수
- name: MALLOC_ARENA_MAX