103 lines
2.7 KiB
Markdown
Executable File
103 lines
2.7 KiB
Markdown
Executable File
# Web Portal - Kubernetes 배포 가이드
|
|
|
|
## 📁 프로젝트 구조
|
|
|
|
```
|
|
k8s-portal/
|
|
├── backend/
|
|
│ ├── main.py # FastAPI 백엔드 (전체 API)
|
|
│ ├── requirements.txt
|
|
│ └── Dockerfile
|
|
├── frontend/
|
|
│ ├── index.html # 싱글 페이지 앱 (SPA)
|
|
│ ├── nginx.conf # Nginx 설정 (API 프록시 포함)
|
|
│ └── Dockerfile
|
|
├── k8s/
|
|
│ ├── 01-namespace.yaml # web-portal 네임스페이스
|
|
│ ├── 02-postgres.yaml # PostgreSQL + PVC + Service
|
|
│ ├── 03-secrets.yaml # DB 패스워드, JWT 시크릿
|
|
│ ├── 04-backend.yaml # FastAPI Deployment + Service
|
|
│ └── 05-frontend.yaml # Nginx Deployment + NodePort(30080)
|
|
├── build-and-deploy.sh # 원클릭 빌드 & 배포
|
|
├── cleanup.sh # 전체 삭제
|
|
└── README.md
|
|
```
|
|
|
|
## 🚀 설치 및 실행
|
|
|
|
### 전제 조건
|
|
- Docker Desktop 설치 및 실행
|
|
- Docker Desktop > Settings > Kubernetes > Enable Kubernetes ✅
|
|
|
|
### 배포 (원클릭)
|
|
```bash
|
|
chmod +x build-and-deploy.sh
|
|
./build-and-deploy.sh
|
|
```
|
|
|
|
### 접속
|
|
브라우저에서: **http://localhost:30080**
|
|
|
|
## 🔑 기본 계정
|
|
|
|
| 구분 | ID | Password |
|
|
|------|-----|----------|
|
|
| 관리자 | `admin` | `admin1234` |
|
|
| 일반사용자 | `user1` | `user1234` |
|
|
|
|
## ✨ 기능 설명
|
|
|
|
### 일반 사용자
|
|
- 로그인 후 **본인에게 할당된 웹페이지 목록** 확인
|
|
- 카드 클릭 시 **새 탭에서 해당 URL로 이동**
|
|
|
|
### 관리자
|
|
일반 사용자 기능 + 추가:
|
|
- **페이지 관리**: 웹페이지 추가/수정/삭제
|
|
- **사용자 관리**: 계정 생성/삭제
|
|
- **권한 설정**: 사용자별 접근 가능 페이지 체크박스로 지정
|
|
|
|
## 🔧 운영 명령어
|
|
|
|
```bash
|
|
# 전체 리소스 상태 확인
|
|
kubectl get all -n web-portal
|
|
|
|
# 백엔드 로그 확인
|
|
kubectl logs -n web-portal deployment/backend -f
|
|
|
|
# 프론트엔드 로그 확인
|
|
kubectl logs -n web-portal deployment/frontend -f
|
|
|
|
# 재시작
|
|
kubectl rollout restart deployment/backend -n web-portal
|
|
kubectl rollout restart deployment/frontend -n web-portal
|
|
|
|
# 전체 삭제
|
|
./cleanup.sh
|
|
```
|
|
|
|
## 🔐 운영 시 보안 설정
|
|
|
|
`k8s/03-secrets.yaml`에서 반드시 변경:
|
|
```yaml
|
|
stringData:
|
|
db-password: "강력한패스워드로변경" # PostgreSQL 패스워드
|
|
jwt-secret: "64자이상의랜덤문자열로변경" # JWT 서명 키
|
|
```
|
|
|
|
## 🏗️ 아키텍처
|
|
|
|
```
|
|
브라우저
|
|
│
|
|
▼ :30080 (NodePort)
|
|
[Nginx Frontend] ─── 정적 HTML/JS 제공
|
|
│ /api/* 프록시
|
|
▼
|
|
[FastAPI Backend] ─── JWT 인증, REST API
|
|
│
|
|
▼
|
|
[PostgreSQL] ─── 사용자, 페이지, 권한 데이터
|
|
```
|