Skip to content

Commit 2fbde4d

Browse files
committed
Add Kubernetes deployment instructions and update service configurations; introduce deploy script and adjust resource limits
1 parent bd17b87 commit 2fbde4d

File tree

7 files changed

+41
-15
lines changed

7 files changed

+41
-15
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,15 @@ Following commands are useful to build and push the images one by one
528528
./src/apps/scripts/push-images.sh
529529
```
530530

531+
### How to deploy the application on Kubernetes
532+
533+
You can deploy the application on Kubernetes cluster.
534+
535+
``` bash
536+
# Build images
537+
./src/apps/scripts/deploy-k8s.sh
538+
```
539+
531540

532541
### Deploy in a cloud instance
533542

src/apps/k8s/apigateway.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ spec:
4747
secretKeyRef:
4848
name: gnx-app-secrets
4949
key: MONGODB_CONNECTION_STRING
50+
# Reverse Proxy
51+
- name: reverseProxy__clusters__identities-cluster__destinations__destination1__address
52+
value: http://identities-svc
53+
- name: reverseProxy__clusters__products-cluster__destinations__destination1__address
54+
value: http://products-svc
55+
- name: reverseProxy__clusters__orders-cluster__destinations__destination1__address
56+
value: http://orders-svc
57+
- name: reverseProxy__clusters__notifications-cluster__destinations__destination1__address
58+
value: http://notifications-svc
5059

5160
ports:
5261
- containerPort: 8080 # Port the container exposes

src/apps/k8s/notifications.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
spec:
1818
containers:
1919
- name: notifications-container
20-
image: genocs/notifications-webapi:1.0.3 # Replace with your image
20+
image: genocs/notifications-webapi:1.0.4 # Replace with your image
2121
env:
2222
- name: ASPNETCORE_ENVIRONMENT
2323
value: "Development"
@@ -52,11 +52,11 @@ spec:
5252
- containerPort: 8080 # Port the container exposes
5353
resources: # Optional resource requests and limits
5454
requests:
55+
cpu: 50m
56+
memory: 100Mi
57+
limits:
5558
cpu: 100m
5659
memory: 200Mi
57-
limits:
58-
cpu: 200m
59-
memory: 400Mi
6060

6161
---
6262
# notifications-service.yml

src/apps/k8s/orders.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,18 @@ spec:
4747
secretKeyRef:
4848
name: gnx-app-secrets
4949
key: MONGODB_CONNECTION_STRING
50+
- name: httpclient__services__products
51+
value: "http://products-svc"
5052

5153
ports:
5254
- containerPort: 8080 # Port the container exposes
5355
resources: # Optional resource requests and limits
5456
requests:
57+
cpu: 50m
58+
memory: 100Mi
59+
limits:
5560
cpu: 100m
5661
memory: 200Mi
57-
limits:
58-
cpu: 200m
59-
memory: 400Mi
6062

6163
---
6264
# orders-service.yml

src/apps/k8s/products.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ spec:
5252
- containerPort: 8080 # Port the container exposes
5353
resources: # Optional resource requests and limits
5454
requests:
55+
cpu: 50m
56+
memory: 100Mi
57+
limits:
5558
cpu: 100m
5659
memory: 200Mi
57-
limits:
58-
cpu: 200m
59-
memory: 400Mi
6060

6161
---
6262
# products-service.yml

src/apps/scripts/build-images.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@ cd ./src/apps
66
export $(grep -v '^#' ./local.env | xargs)
77

88

9-
109
# Build the api gateway
1110
docker build -t genocs/apigateway:$IMAGE_VERSION -t genocs/apigateway:latest -f ./apigateway.dockerfile .
1211

1312
# Build the identities service
14-
docker build -t genocs/identities:$IMAGE_VERSION -t genocs/identities:latest -f ./identities.dockerfile .
13+
docker build -t genocs/identities-webapi:$IMAGE_VERSION -t genocs/identities-webapi:latest -f ./identities.dockerfile .
1514

1615
# Build the products service
17-
docker build -t genocs/products:$IMAGE_VERSION -t genocs/products:latest -f ./products.dockerfile .
16+
docker build -t genocs/products-webapi:$IMAGE_VERSION -t genocs/products-webapi:latest -f ./products.dockerfile .
1817

1918
# Build the orders service
20-
docker build -t genocs/orders:$IMAGE_VERSION -t genocs/orders:latest -f ./orders.dockerfile .
19+
docker build -t genocs/orders-webapi:$IMAGE_VERSION -t genocs/orders-webapi:latest -f ./orders.dockerfile .
2120

2221
# Build the notifications service
23-
docker build -t genocs/notifications:$IMAGE_VERSION -t genocs/notifications:latest -f ./notifications.dockerfile .
22+
docker build -t genocs/notifications-webapi:$IMAGE_VERSION -t genocs/notifications-webapi:latest -f ./notifications.dockerfile .
2423

2524
cd ..
2625
cd ..

src/apps/scripts/deploy-k8s.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
4+
for service in apigateway identities products orders notifications
5+
do
6+
microk8s kubectl apply -f ./$service.yml
7+
done

0 commit comments

Comments
 (0)