# deployment/manifests/deployment.yaml - Base Image ํ˜ธํ™˜ ๋ฒ„์ „ apiVersion: apps/v1 kind: Deployment metadata: name: vector-api labels: app: vector-api version: v1.0.9 annotations: deployment.kubernetes.io/revision: "9" description: "Vector DB API with Base Image Compatibility" spec: replicas: 1 strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 0 maxSurge: 1 selector: matchLabels: app: vector-api template: metadata: labels: app: vector-api version: v1.0.9 annotations: prometheus.io/scrape: "true" prometheus.io/port: "8000" prometheus.io/path: "/metrics" spec: # ๐Ÿ”ง initContainer ์ œ๊ฑฐ - Base Image ์„ค์ • ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉ containers: - name: vector-api image: acrdigitalgarage03.azurecr.io/vector-api:latest imagePullPolicy: Always # ๐Ÿ”ง ์ปจํ…Œ์ด๋„ˆ ํฌํŠธ ports: - name: http containerPort: 8000 protocol: TCP # ๐Ÿ”ง ํ™˜๊ฒฝ๋ณ€์ˆ˜ (ConfigMap๋งŒ ์‚ฌ์šฉ, Poetry ์„ค์ • ์ œ์™ธ) envFrom: - configMapRef: name: vector-api-config env: - name: CLAUDE_API_KEY valueFrom: secretKeyRef: name: vector-api-secret key: CLAUDE_API_KEY - name: HOME value: "/home/appuser" - name: USER value: "appuser" # ๐Ÿ”ง Poetry ๊ด€๋ จ ํ™˜๊ฒฝ๋ณ€์ˆ˜ ๋ชจ๋‘ ์ œ๊ฑฐ (Base Image ์„ค์ • ์œ ์ง€) # โŒ ์ œ๊ฑฐ: POETRY_CONFIG_DIR, POETRY_DATA_DIR, POETRY_CACHE_DIR # โŒ ์ œ๊ฑฐ: POETRY_VENV_PATH, POETRY_VIRTUALENVS_IN_PROJECT # ๐Ÿ—‚๏ธ ๋ณผ๋ฅจ ๋งˆ์šดํŠธ (๋‹จ์ˆœํ™”) volumeMounts: - name: vector-db-storage mountPath: /home/appuser/vectordb - name: tmp-volume mountPath: /tmp # ๐Ÿ”ง ๋ณด์•ˆ ์ปจํ…์ŠคํŠธ securityContext: runAsNonRoot: true runAsUser: 1000 runAsGroup: 1000 allowPrivilegeEscalation: false readOnlyRootFilesystem: false capabilities: drop: - ALL # ๐Ÿ”ง ๋ฆฌ์†Œ์Šค ์„ค์ • resources: requests: memory: "2Gi" cpu: "500m" limits: memory: "4Gi" cpu: "1000m" # ๐Ÿฅ ํ—ฌ์Šค์ฒดํฌ (Base Image ๊ฐ€์ƒํ™˜๊ฒฝ ํ™•์ธ) livenessProbe: exec: command: - /bin/sh - -c - | # Base Image ๊ฐ€์ƒํ™˜๊ฒฝ ํ™•์ธ poetry run python -c "import fastapi; print('โœ… ์ •์ƒ')" 2>/dev/null || exit 1 initialDelaySeconds: 60 periodSeconds: 30 timeoutSeconds: 10 failureThreshold: 3 readinessProbe: exec: command: - /bin/sh - -c - | # Base Image ํŒจํ‚ค์ง€ ํ™•์ธ poetry run python -c "import fastapi, uvicorn, pydantic; print('โœ… ์ค€๋น„๋จ')" 2>/dev/null || exit 1 initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 3 startupProbe: exec: command: - /bin/sh - -c - | # Poetry ํ™˜๊ฒฝ ํ™•์ธ poetry env info && poetry show | head -5 initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 10 failureThreshold: 12 # 60์ดˆ ๋Œ€๊ธฐ # ๐Ÿ“ฆ ๋ณผ๋ฅจ ์„ค์ • (๋‹จ์ˆœํ™”) volumes: - name: vector-db-storage #emptyDir: # sizeLimit: 10Gi persistentVolumeClaim: claimName: vector-db-pvc - name: tmp-volume emptyDir: sizeLimit: 500Mi # ๐Ÿ” ACR ์ ‘๊ทผ imagePullSecrets: - name: acr-secret # ๐ŸŽฏ ๋…ธ๋“œ ์„ ํƒ nodeSelector: agentpool: aipool tolerations: - key: "dedicated" operator: "Equal" value: "aipool" effect: "NoSchedule" # ๐Ÿ”ง Pod ๋ ˆ๋ฒจ ๋ณด์•ˆ securityContext: runAsNonRoot: true runAsUser: 1000 runAsGroup: 1000 fsGroup: 1000 restartPolicy: Always dnsPolicy: ClusterFirst terminationGracePeriodSeconds: 30