@@ -106,20 +106,86 @@ The project includes Docker configurations for containerized deployment.
106106
1071071 . Build and start the services:
108108 ``` bash
109- docker- compose up --build
109+ docker compose up --build
110110 ```
1111112 . Access the application:
112112 - Client: [ http://localhost:3000 ] ( http://localhost:3000 )
113113 - Server: [ http://localhost:8080 ] ( http://localhost:8080 )
114114
115- ### Production Deployment
115+ ## Kubernetes Deployment
116116
117- Use the ` docker-compose.prod.yml ` file for production deployment. Ensure environment variables are set correctly.
117+ This project can be deployed to a Kubernetes cluster. The Kubernetes configuration files are located in the ` k8s ` directory.
118+
119+ ### Ensure Docker Desktop Kubernetes is Active
120+
121+ Before deploying, make sure you're using Docker Desktop's Kubernetes:
122+
123+ 1 . Verify that Kubernetes is enabled in Docker Desktop:
124+ - Open Docker Desktop
125+ - Go to Settings/Preferences
126+ - Select "Kubernetes" from the left menu
127+ - Check "Enable Kubernetes"
128+ - Click "Apply & Restart" if needed
129+
130+ 2 . Confirm Docker Desktop is your current kubectl context:
131+ ``` bash
132+ kubectl config current-context
133+ ```
134+ This should return ` docker-desktop ` or similar.
135+
136+ 3 . If needed, switch to Docker Desktop context:
137+ ``` bash
138+ kubectl config use-context docker-desktop
139+ ```
140+
141+ ### Deploy to Local Kubernetes
142+
143+ Follow these steps to deploy the application correctly:
144+
145+ 1 . Create the namespace and deploy all resources at once:
146+ ``` bash
147+ kubectl apply -f k8s/namespace.yaml
148+ kubectl apply -f k8s
149+ ```
150+
151+ 2 . Check the status of all deployed resources:
152+ ``` bash
153+ kubectl -n canteen-app get all
154+ ```
155+
156+ 3 . Get the server service port details:
157+ ``` bash
158+ kubectl -n canteen-app get service
159+ ```
160+
161+ 4 . Update the configmap with the correct server port from the previous step:
162+ ``` bash
163+ # Edit the configmap with the allocated server port
164+ kubectl edit configmap app-config -n canteen-app
165+ ```
166+
167+ In the editor that opens, update the SERVER_PORT value to match the port from step 3.
168+
169+ 5 . Restart the client deployment to pick up the new configmap values:
170+ ``` bash
171+ kubectl rollout restart deployment client -n canteen-app
172+ ```
173+
174+ 6 . Verify all components are running correctly:
175+ ``` bash
176+ kubectl -n canteen-app get all
177+ ```
178+
179+ ### Accessing the Application
180+
181+ After deployment, you can access the application through the client service. Get the client service port:
118182
119183``` bash
120- docker-compose -f docker-compose.prod.yml up -d
184+ kubectl -n canteen-app get service
121185```
122186
187+ The application will be available at ` http://localhost:<CLIENT_PORT> ` where ` <CLIENT_PORT> ` is the port mapped to port 3000 in the client service.
188+
123189## CI/CD Pipeline
124190
125191The project includes GitHub Actions workflows for:
@@ -139,8 +205,7 @@ The project includes GitHub Actions workflows for:
139205│ ├── build.gradle # Gradle build file
140206│ └── Dockerfile # Server Dockerfile
141207│
142- ├── docker-compose.yml # Docker Compose for local development
143- ├── docker-compose.prod.yml # Docker Compose for production
208+ ├── compose.yml # Docker Compose for local development
144209└── .github/workflows/ # CI/CD workflows
145210```
146211
0 commit comments