File size: 2,014 Bytes
e566277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@echo off
REM Phase IV Kubernetes Deploy Script for Windows
REM Deploys the application to Kubernetes using kubectl

setlocal

set SCRIPT_DIR=%~dp0
set PROJECT_ROOT=%SCRIPT_DIR%..
set K8S_DIR=%PROJECT_ROOT%\infra\k8s

echo =========================================
echo Phase IV - Deploying to Kubernetes
echo =========================================

REM Check if kubectl is available
where kubectl >nul 2>nul
if %ERRORLEVEL% neq 0 (
    echo Error: kubectl not found. Please install kubectl first.
    echo See: phase-4\docs\INSTALL-WINDOWS.md
    pause
    exit /b 1
)

REM Check cluster connection
echo.
echo Checking cluster connection...
kubectl cluster-info >nul 2>nul
if %ERRORLEVEL% neq 0 (
    echo Error: Cannot connect to Kubernetes cluster.
    echo Please ensure your cluster is running and kubeconfig is configured.
    pause
    exit /b 1
)

echo Cluster connected successfully.

REM Create namespace
echo.
echo Creating namespace...
kubectl apply -f "%K8S_DIR%\namespace.yaml"

REM Deploy in order
echo.
echo Deploying PostgreSQL...
kubectl apply -f "%K8S_DIR%\00-postgres.yaml"

echo.
echo Deploying Ollama...
timeout /t 5 /nobreak >nul
kubectl apply -f "%K8S_DIR%\01-ollama.yaml"

echo.
echo Deploying Backend...
timeout /t 5 /nobreak >nul
kubectl apply -f "%K8S_DIR%\02-backend.yaml"

echo.
echo Deploying Chatbot...
timeout /t 5 /nobreak >nul
kubectl apply -f "%K8S_DIR%\03-chatbot.yaml"

echo.
echo Deploying Frontend...
timeout /t 5 /nobreak >nul
kubectl apply -f "%K8S_DIR%\04-frontend.yaml"

echo.
echo =========================================
echo Deployment Complete!
echo.
echo Services:
kubectl get svc -n todo-app
echo.
echo Pods:
kubectl get pods -n todo-app
echo.
echo =========================================
echo To access the application:
echo 1. For local development, use port-forward:
echo    kubectl port-forward -n todo-app svc/frontend-service 3000:3000
echo.
echo 2. For production, configure an Ingress controller
echo =========================================

pause