Skip to content

Commit 9bc78af

Browse files
authored
Merge pull request #15 from ibm-cloud-architecture/bck-updateLimitRanges
Bck update limit ranges
2 parents af2a5b3 + ef0e351 commit 9bc78af

File tree

2 files changed

+200
-0
lines changed

2 files changed

+200
-0
lines changed
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# Limit Ranges
2+
3+
In an OpenShift Container Platform cluster, containers run with unlimited compute resources. By using limit ranges, you can restrict the amount of resources consumed for the following objects within a project.
4+
5+
- Pods/Containers: You can set minimum and maximum requirements for CPU and memory
6+
7+
- Image Streams: You can set limits on the number of images and tags in an _ImageStream_ object
8+
9+
- Images: You can limit the size of images that can be pushed to a registry
10+
11+
- Persistent Volume Claims (PVC): You can restrict the size of the PVCs that can be requested
12+
13+
A _LimitRange_ object allows you to restrict the amount of resources that can be consumed in a project. Any request that is made to create or modify a resource will be validated against any _LimitRange_ objects in the project. If any of the constraints listed in the _LimitRange_ object are violated, then the resource request is rejected.
14+
15+
## Creating a Limit Range
16+
17+
To create a _LimitRange_ object you can follow the example below:
18+
19+
```
20+
apiVersion: "v1"
21+
kind: "LimitRange"
22+
metadata:
23+
name: "resource-limits"
24+
spec:
25+
limits:
26+
- type: "Pod"
27+
max:
28+
cpu: "2"
29+
memory: "1Gi"
30+
min:
31+
cpu: "200m"
32+
memory: "6Mi"
33+
- type: "Container"
34+
max:
35+
cpu: "2"
36+
memory: "1Gi"
37+
min:
38+
cpu: "100m"
39+
memory: "4Mi"
40+
default:
41+
cpu: "300m"
42+
memory: "200Mi"
43+
defaultRequest:
44+
cpu: "200m"
45+
memory: "100Mi"
46+
maxLimitRequestRatio:
47+
cpu: "10"
48+
- type: openshift.io/Image
49+
max:
50+
storage: 1Gi
51+
- type: openshift.io/ImageStream
52+
max:
53+
openshift.io/image-tags: 20
54+
openshift.io/images: 30
55+
- type: "PersistentVolumeClaim"
56+
min:
57+
storage: "2Gi"
58+
max:
59+
storage: "50Gi"
60+
```
61+
62+
### Container Limits
63+
64+
```
65+
apiVersion: "v1"
66+
kind: "LimitRange"
67+
metadata:
68+
name: "resource-limits" [1]
69+
spec:
70+
limits:
71+
- type: "Container"
72+
max:
73+
cpu: "2" [2]
74+
memory: "1Gi" [3]
75+
min:
76+
cpu: "100m" [4]
77+
memory: "4Mi" [5]
78+
default:
79+
cpu: "300m" [6]
80+
memory: "200Mi" [7]
81+
defaultRequest:
82+
cpu: "200m" [8]
83+
memory: "100Mi" [9]
84+
maxLimitRequestRatio:
85+
cpu: "10" [10]
86+
```
87+
88+
[1] The name of the _LimitRange_ object
89+
90+
[2] The maximum amount of CPU that a single container in a pod can request
91+
92+
[3] The maximum amount of memory that a single container in a pod can request
93+
94+
[4] The minimum amount of CPU that a single container in a pod can request
95+
96+
[5] The minimum amount of memory that a single container in a pod can request
97+
98+
[6] The default amount of CPU that a container can use if not specified in the _Pod_ spec
99+
100+
[7] The default amount of memory that a container can use if not specified in teh _Pod_ spec
101+
102+
[8] The default amount of CPU that a contianer can request if not specified in the _Pod_ spec
103+
104+
[9] The default amount of memory that a container can request if not specified in the _Pod_ spec
105+
106+
[10] The maximum limit-to-request ratio for a container
107+
108+
### Pod Limits
109+
110+
```
111+
apiVersion: "v1"
112+
kind: "LimitRange"
113+
metadata:
114+
name: "resource-limits" [1]
115+
spec:
116+
limits:
117+
- type: "Pod"
118+
max:
119+
cpu: "2" [2]
120+
memory: "1Gi" [3]
121+
min:
122+
cpu: "200m" [4]
123+
memory: "6Mi" [5]
124+
maxLimitRequestRatio:
125+
cpu: "10" [6]
126+
```
127+
128+
[1] The name of the _LimitRange_ object
129+
130+
[2] The maximum amount of CPU that a pod can request across all containers
131+
132+
[3] The maximum amount of memory that a pod can request across all containers
133+
134+
[4] The minimum amount of CPU that a pod can request across all containers
135+
136+
[5] The minimum amount of memory that a pod can request across all containers
137+
138+
[6] The maximum limit-to-request ration for a container
139+
140+
### Image Limits
141+
142+
```
143+
apiVersion: "v1"
144+
kind: "LimitRange"
145+
metadata:
146+
name: "resource-limits" [1]
147+
spec:
148+
limits:
149+
- type: openshift.io/Image
150+
max:
151+
storage: 1Gi [2]
152+
```
153+
154+
[1] The name of the _LimitRange_ object
155+
156+
[2] The maximum size of an image that can be pushed to a registry
157+
158+
### Image Stream Limits
159+
160+
```
161+
apiVersion: "v1"
162+
kind: "LimitRange"
163+
metadata:
164+
name: "resource-limits" [1]
165+
spec:
166+
limits:
167+
- type: openshift.io/ImageStream
168+
max:
169+
openshift.io/image-tags: 20 [2]
170+
openshift.io/images: 30 [3]
171+
```
172+
173+
[1] The name of the _LimitRange_ object
174+
175+
[2] The maximum number of unique image tags in the _imagestream.spec.tags_ parameter in _imagestream_ spec
176+
177+
[3] The maximum number of unique image regerenes in the _imagestream.status.tags_ parameter in the _imagestream_ spec
178+
179+
### Persistent Volume Claim Limits
180+
181+
```
182+
apiVersion: "v1"
183+
kind: "LimitRange"
184+
metadata:
185+
name: "resource-limits" [1]
186+
spec:
187+
limits:
188+
- type: "PersistentVolumeClaim"
189+
min:
190+
storage: "2Gi" [2]
191+
max:
192+
storage: "50Gi" [3]
193+
```
194+
195+
[1] The name of the _LimitRange_ object
196+
197+
[2] The minimum amount of storage that can be requested in a persistent volume claim
198+
199+
[3] The maximum amount of storage that can be requested in a persistent volume claim

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ nav:
9090
- <div class="sub-section">Secrets</div>: openshift/configuration/secrets/index.md
9191
- <div class="sub-section">Security Contexts</div>: openshift/configuration/security-contexts/index.md
9292
- <div class="sub-section">Service Accounts</div>: openshift/configuration/service-accounts/index.md
93+
- <div class="sub-section">Limit Ranges</div>: openshift/configuration/limit-ranges/index.md
9394
- <div class="header">Deployments</div>:
9495
- openshift/deployments/index.md
9596
- <div class="sub-section">Rolling Updates</div>: openshift/deployments/updates/index.md

0 commit comments

Comments
 (0)