kubernetes: resource limits seems to be ignored when deploying a pod
What happened?
I deployed a pod with limits.cpu
and limits.memory
on a namesapace with a ResourceQuota
set with limits.cpu
and limits.memory
elements and I get the error: failed quota: <quota name>: must specify limits.cpu,limits.memory
What did you expect to happen?
The pod to be deployed
How can we reproduce it (as minimally and precisely as possible)?
Create a new namespace
kubectl create ns rq
Create (using a manifest file named resource-quota-manifest.yaml) and verify a ResourceQuota
named compute-resources
Content of the resource-quota-manifest.yaml file
apiVersion: v1
kind: ResourceQuota
metadata:
name: compute-resources
spec:
hard:
requests.cpu: "10"
requests.memory: 10Gi
limits.cpu: "20"
limits.memory: 20Gi
kubectl -n qt apply -f resource-quota-manifest.yaml; kubectl -n qt describe quota compute-resources
resourcequota/compute-resources created
Name: compute-resources
Namespace: qt
Resource Used Hard
-------- ---- ----
limits.cpu 0 20
limits.memory 0 20Gi
requests.cpu 0 10
requests.memory 0 10Gi
Create (using a manifest file named pod.yaml) a pod named high-priority with the spec.containers[].resources.requests
and spec.containers[].resources.limits
for both memory
and cpu
.
Content of the pod.yaml file
apiVersion: v1
kind: Pod
metadata:
name: high-priority
spec:
containers:
- name: high-priority
image: ubuntu
command: ["/bin/sh"]
args: ["-c", "while true; do echo hello; sleep 10;done"]
resources:
requests:
memory: "1Gi"
cpu: "500m"
limits:
memory: "1Gi"
cpu: "500m"
kubectl -n qt create -f pod.yaml
Error from server (Forbidden): error when creating "pod.yaml": pods "high-priority" is forbidden: failed quota: compute-resources: must specify limits.cpu,limits.memory
Anything else we need to know?
The pod is deployed correctly if I delete the ResourceQuota
Kubernetes version
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.2", GitCommit:"59603c6e503c87169aea6106f57b9f242f64df89", GitTreeState:"clean", BuildDate:"2020-01-18T23:30:10Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.20-eks-8c579e", GitCommit:"8c579edfc914f013ff48b2a2b2c1308fdcacc53f", GitTreeState:"clean", BuildDate:"2021-07-31T01:34:13Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
Cloud provider
aws
OS version
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$ uname -a
Linux DESKTOP-7S3S4P5 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux
Install tools
Container runtime (CRI) and and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (9 by maintainers)
hi @pablocavalieri the fix pr has been merged, maybe u could use it to locate which container is causing the problem.
It’s probably that, but IDK which WebHook is doing that. The feature you suggested would really help.