-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy-k8s.bat
More file actions
72 lines (60 loc) · 2.25 KB
/
deploy-k8s.bat
File metadata and controls
72 lines (60 loc) · 2.25 KB
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
@echo off
setlocal
:: Define Cluster and Namespace Names
set CLUSTER_NAME=fallsafe-cluster
set NAMESPACE=fallsafe-namespace
set DOCKER_USER=cheeguang :: Replace with your Docker Hub username
:: Step 1: Create Kubernetes Cluster with k3d
echo Creating Kubernetes Cluster...
k3d cluster create %CLUSTER_NAME% --servers 1 --agents 2
if %errorlevel% neq 0 (
echo Cluster creation failed! Exiting...
exit /b
)
timeout /t 5
:: Step 2: Configure kubectl to Use k3d Cluster
echo Setting kubectl context...
kubectl config use-context k3d-%CLUSTER_NAME%
if %errorlevel% neq 0 (
echo Failed to set Kubernetes context! Exiting...
exit /b
)
timeout /t 2
:: Step 3: Create Namespace
echo Creating namespace: %NAMESPACE%...
kubectl create namespace %NAMESPACE%
timeout /t 2
:: Step 4: Create Kubernetes Secrets
echo Creating Kubernetes Secrets...
kubectl apply -f k8s/microservices.secrets.yaml --namespace=%NAMESPACE%
timeout /t 2
kubectl create secret docker-registry dockerhubsecret --docker-server=https://index.docker.io/v1/ --docker-username=cheeguang --docker-password=0@Jl123123 --docker-email=jeffreyleetino@gmail.com --namespace=fallsafe-namespace
:: Step 5: Deploy Services
echo Deploying Services...
kubectl apply -f k8s/services.yaml --namespace=%NAMESPACE%
timeout /t 2
:: Step 6: Deploy Microservices
echo Deploying Microservices...
kubectl apply -f k8s/admin-deployment.yaml --namespace=%NAMESPACE%
kubectl apply -f k8s/auth-deployment.yaml --namespace=%NAMESPACE%
kubectl apply -f k8s/fallsEfficacy-deployment.yaml --namespace=%NAMESPACE%
kubectl apply -f k8s/openAI-deployment.yaml --namespace=%NAMESPACE%
kubectl apply -f k8s/selfAssessment-deployment.yaml --namespace=%NAMESPACE%
kubectl apply -f k8s/user-deployment.yaml --namespace=%NAMESPACE%
timeout /t 2
:: Step 7: Deploy Frontend
echo Deploying Frontend...
kubectl apply -f k8s/frontend-deployment.yaml --namespace=%NAMESPACE%
timeout /t 2
:: Step 8: Verify Deployment
echo Verifying Deployment...
kubectl get pods --namespace=%NAMESPACE%
kubectl get services --namespace=%NAMESPACE%
timeout /t 3
:: Step 9: Retrieve Frontend URL (For LoadBalancer)
echo Retrieving Frontend Service External IP...
kubectl get svc frontend-service --namespace=%NAMESPACE%
timeout /t 3
echo Kubernetes deployment complete!
endlocal
pause