Skip to content

Commit 36616fa

Browse files
committed
Set pod afinity (to spread) and min/max memory
We did have: `The node was low on resource: memory. Threshold quantity: 100Mi, available: 98816Ki. Container web was using 2450044Ki, request is 0, has larger consumption of memory.` errors
1 parent b990cc4 commit 36616fa

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

apps/web/base/deployment.yaml

+18-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
labels:
77
app: web
88
spec:
9-
replicas: 3
9+
replicas: 4
1010
selector:
1111
matchLabels:
1212
app: web
@@ -15,6 +15,17 @@ spec:
1515
labels:
1616
app: web
1717
spec:
18+
# spread nodes across servers
19+
affinity:
20+
podAntiAffinity:
21+
requiredDuringSchedulingIgnoredDuringExecution:
22+
- labelSelector:
23+
matchExpressions:
24+
- key: app
25+
operator: In
26+
values:
27+
- web
28+
topologyKey: "kubernetes.io/hostname"
1829
containers:
1930
- name: web
2031
image: metacpan/metacpan-web:latest
@@ -23,6 +34,12 @@ spec:
2334
args: [ "--http-socket", ":5001" ]
2435
ports:
2536
- containerPort: 5001
37+
resources:
38+
# Manage how much memory is allocated, could add cpu if we wanted
39+
requests:
40+
memory: "1024Mi"
41+
limits:
42+
memory: "3072Mi"
2643
volumeMounts:
2744
- name: metacpan-web-local
2845
mountPath: /app/metacpan_web_local.conf

0 commit comments

Comments
 (0)