Permalink
Browse files

Add resource requests/limits for all containers

All the containers I deploy should have resource requests/limits.
Currently, for simplicities sake, I make those request and the limit
values the same. Essentially, that's guaranteeing the container will
have X resources to function.

The summation of the container requests is equivalent to the resources
my cluster needs. By specifying resource requests/limits before
deploying the pod, I'll find out at deploy time if I don't have the
necessary resources to run an application on my cluster.

I can use `kubectl describe node` to get more information about the
resource requests of each pod and their summation on each node.

For now, these values are best guesses. However, I will reevaluate them
over time as I get more experience running k8s.
  • Loading branch information...
mattjmcnaughton committed Nov 21, 2018
1 parent ff9d5fb commit 382be789d50f60a1a323cdf8a75fa53cbe213750
@@ -11,3 +11,10 @@ spec:
# availability.
replicas: 2
serviceAccountName: alertmanager
resources:
requests:
cpu: "100m"
memory: "100Mi"
limits:
cpu: "100m"
memory: "100Mi"
@@ -21,3 +21,10 @@ spec:
- name: http
containerPort: 80
protocol: TCP
resources:
requests:
cpu: "100m"
memory: "100Mi"
limits:
cpu: "100m"
memory: "100Mi"
@@ -27,6 +27,13 @@ spec:
- name: http
containerPort: 3000
protocol: TCP
resources:
requests:
cpu: "250m"
memory: "250Mi"
limits:
cpu: "250m"
memory: "250Mi"
env:
# @TODO(mattjmcnaughton) Long term, this password should certainly not
# be plain text nor `password`. For now, it doesn't matter as the
@@ -38,7 +38,13 @@ spec:
command:
- /metrics-server
- --kubelet-insecure-tls
resources:
limits:
cpu: 200m
memory: 100Mi
requests:
cpu: 200m
memory: 100Mi
volumeMounts:
- name: tmp-dir
mountPath: /tmp

@@ -28,8 +28,8 @@ spec:
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 50Mi
cpu: 200m
memory: 100Mi
securityContext:
runAsNonRoot: true
runAsUser: 65534
@@ -38,7 +38,11 @@ spec:
port: web
resources:
requests:
memory: 400Mi
cpu: "200m"
memory: "400Mi"
limits:
cpu: "200m"
memory: "400Mi"
# @TODO(mattjmcnaughton) Determine a way to make this work when using
# Minikube. I may need to wait until I'm templating this via a Helm chart.
storage:

0 comments on commit 382be78

Please sign in to comment.