
Let's say something like this is being returned.
failed quota: my-quota: must specify limits.cpu,limits.memory,requests.cpu,requests.memory
In this example, there is a quota or cluster resource quota named my-quota. The oc get quota command with the --all-namespaces flag and grep can be used to determine if my-quota is a quota in a certain project. Similarly, the oc get clusterresourcequota could be used to determine if my-quota is a cluster resource quota.
~]$ oc get quota --all-namespaces | grep my-quota
my-project my-quota 8m27s pods: 8/10, requests.cpu: 30m/1, requests.memory: 288Mi/1Gi limits.cpu: 1500m/2, limits.memory: 384Mi/2Gi
Notice in this example that my-quota has quotas for.
- requests.cpu
- requests.memory
- limits.cpu
- limits.memory
In this scenario, check your deployment or deployment config YAML for the requests/limits cpu/memory. If your deployment or deployment config does not have these settings, updating your deployment or deployment config to have these setting will probably resolve this issue. Check out my article on updating your deployment or deployment config with CPU and Memory requests and limits.
Be aware that you may need to specify the resource CPU and Memory requests and limits under both strategy and containers in your YAML.
spec:
strategy:
resources:
requests:
cpu: 10m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
template:
spec:
containers:
- name: hello-openshift
image: openshift/hello-openshift:latest
resources:
requests:
cpu: 10m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
Or if you are using limits to set the min and max CPU and Memory for pods and containers in the project, ensure your limits has min and max CPU and memory for both pods and containers.
apiVersion: v1
kind: LimitRange
metadata:
name: my-limits
spec:
limits:
- type: Pod
max:
cpu: 20m
memory: 1Gi
min:
cpu: 200m
memory: 6Mi
- type: Container
max:
cpu: 2
memory: 1Gi
min:
cpu: 100m
memory: 4Mi
Did you find this article helpful?
If so, consider buying me a coffee over at