-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path13-RESOURCE REQUIREMENTS AND LMITS
66 lines (57 loc) · 1.77 KB
/
13-RESOURCE REQUIREMENTS AND LMITS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--------------------------------------------------------------------------
RESOURCE REQUIREMENTS AND LMITS
by default kuberenetes assumes a pod or a container in pod requires 0.5 CPU, 256Mi
by default kubernetes sets limits to a pod or a container in pod - default limits 1VCPU , 521Mi
For the POD to pick up those defaults you must have first set those as default values for request and limit by creating a LimitRange in that namespace.
cat > def-limits.yaml
apiVersion: v1
kind: LimitRange
metadata:
name: mem-limit-range
spec:
limits:
- default:
memory: 512Mi
defaultRequest:
memory: 256Mi
type: Container
kubectl apply -f def-limits.yaml
https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/
apiVersion: v1
kind: LimitRange
metadata:
name: cpu-limit-range
spec:
limits:
- default:
cpu: 1
defaultRequest:
cpu: 0.5
type: Container
to increase the limites we need to specify in yaml file
if a container needs more than that then we need to specify that in yaml file
example yaml file with resources - (cat > pod-definition.yaml)
piVersion: v1
kind: Pod
metadata:
name: myapp-pod (this is name of pod)
labels:
app: myapp
anykey: anyvalue
costcenter: US
spec:
containers:
- name: nginx-container (this is name of container in pod)
image: nginx (this is the image that kubernetes gets from docker hub)
ports:
- containerPort: 8080
resources:
requests:
memory: "1Gi"
cpu : 1
limits:
memory: "2Gi"
cpu: 2
limits and requests are set to each container in pod
https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource
--------------------------------------------------------------------------