Skip to content

Commit

Permalink
Merge pull request #1137 from gafderks/docker/resourcelimits
Browse files Browse the repository at this point in the history
Specify resource limits on memory in K8S deployment
  • Loading branch information
gafderks authored Dec 21, 2023
2 parents 0cda642 + cb65f60 commit 023725f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
6 changes: 5 additions & 1 deletion deploy/kubernetes/deployment/database-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ spec:
- pg_isready
periodSeconds: 90
name: database
resources: {}
resources:
limits:
memory: "52428800"
requests:
memory: "31457280"
ports:
- containerPort: 5432
protocol: TCP
Expand Down
6 changes: 5 additions & 1 deletion deploy/kubernetes/deployment/memcached-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ spec:
ports:
- containerPort: 11211
protocol: TCP
resources: {}
resources:
limits:
memory: "314572800"
requests:
memory: "104857600"
restartPolicy: Always
status: {}
6 changes: 5 additions & 1 deletion deploy/kubernetes/deployment/nginx-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ spec:
ports:
- containerPort: 80
protocol: TCP
resources: {}
resources:
limits:
memory: "52428800"
requests:
memory: "31457280"
volumeMounts:
- mountPath: /opt/services/dbase/media
name: media-volume
Expand Down
6 changes: 5 additions & 1 deletion deploy/kubernetes/deployment/web-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ spec:
ports:
- containerPort: 8000
protocol: TCP
resources: {}
resources:
limits:
memory: "524288e3"
requests:
memory: "262144e3"
volumeMounts:
- mountPath: /app/media
name: media-volume
Expand Down
26 changes: 25 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.1"
version: "3.8"

volumes:
postgresql-data:
Expand Down Expand Up @@ -26,6 +26,12 @@ services:
- web
networks:
- backend-network
deploy:
resources:
limits:
memory: 50M
reservations:
memory: 30MB
database:
image: postgres:15.2
volumes:
Expand All @@ -41,6 +47,12 @@ services:
interval: 1m30s
expose:
- 5432
deploy:
resources:
limits:
memory: 50M
reservations:
memory: 30MB
web:
build:
context: .
Expand All @@ -63,12 +75,24 @@ services:
- media-data:/app/media
networks:
- backend-network
deploy:
resources:
limits:
memory: 500M
reservations:
memory: 250M
memcached:
image: memcached:1.6
expose:
- 11211
networks:
- backend-network
deploy:
resources:
limits:
memory: 300M
reservations:
memory: 100M

networks:
backend-network:
Expand Down

0 comments on commit 023725f

Please sign in to comment.