Skip to content

Week2: Kubernetes 기본 배포 (minikube)#2

Merged
hjklo0220 merged 8 commits intomainfrom
week2
Apr 11, 2026
Merged

Week2: Kubernetes 기본 배포 (minikube)#2
hjklo0220 merged 8 commits intomainfrom
week2

Conversation

@hjklo0220
Copy link
Copy Markdown
Collaborator

Summary

  • Kubernetes 기본 오브젝트(Deployment, StatefulSet, Service, Ingress) YAML 직접 작성
  • Kustomize base/overlay 구조로 환경별 설정 분리
  • minikube 로컬 환경에서 전체 스택 동작 확인

변경 내용

  • infra/k8s/base/api/ — Deployment, Service, Ingress, Secret
  • infra/k8s/base/db/ — StatefulSet(PostgreSQL), Service, Secret
  • infra/k8s/overlays/local/ — replicas:3, imagePullPolicy:Never, migrate Job
  • /ready endpoint 추가 (DB 연결 상태 확인)
  • /api prefix 추가 (items routes)
  • app.kubernetes.io/* 공식 레이블 적용
  • PostToolUse hook으로 bash 명령어 자동 로깅
  • docs/minikube.md 트러블슈팅 기록

Test plan

  • kubectl apply -k infra/k8s/overlays/local 으로 전체 스택 기동
  • api 3개 Pod, db-0, migrate Completed 확인
  • minikube tunnelcurl http://127.0.0.1/health 응답 확인
  • curl http://127.0.0.1/api/items 응답 확인

🤖 Generated with Claude Code

hjklo0220 and others added 8 commits April 11, 2026 15:29
- Add checkDbHealth decorator to dbPlugin (routes don't access pg pool directly)
- Add /ready route using app.checkDbHealth() — returns 503 when DB is unavailable
- /health remains liveness-only (process alive, DB-agnostic)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- PostToolUse hook: auto-logs bash commands + output to .claude/session-log.md
- doc-writer skill: reads session-log.md and writes troubleshooting docs
- bypassPermissions mode in settings.json
- session-log.md added to .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move deployment.yaml into api/ directory
- Add api/secret.yaml (api-secret structure)
- Add db/statefulset.yaml with liveness/readiness probes and PVC
- Add db/service.yaml (ClusterIP, name: db)
- Add db/secret.yaml (postgres-secret structure)
- Add wait-for-postgres initContainer and DATABASE_URL env to api Deployment
- Update kustomization.yaml resource paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- replicas: 3 for api
- imagePullPolicy: Never patch (minikube local image)
- environment: local label
- migrate-job.yaml for DB migration (local only)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move service.yaml and ingress.yaml into api/ directory
- Add api Service (ClusterIP port 80→3000)
- Add Ingress (nginx, routes / to api service)
- Register itemsRoute with prefix /api in app.ts
- Update test URLs /items → /api/items
- Update README endpoint table and curl examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace app: <name> with app.kubernetes.io/name, component, part-of
- api: component=backend, db: component=database
- part-of=devopsim on all resources

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hjklo0220 hjklo0220 merged commit b2567f7 into main Apr 11, 2026
1 check passed
@hjklo0220 hjklo0220 deleted the week2 branch April 11, 2026 06:30
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant