Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

"Create resources with ResourceQuota" uses a pod with only a memory limit - should also have a cpu limit #574

Open
parsiya opened this issue Feb 2, 2019 · 0 comments · May be fixed by #575

Comments

@parsiya
Copy link

parsiya commented Feb 2, 2019

In Create resources with ResourceQuota, a ResourceQuota with both CPU and memory limit is set.

$ cat resource-quota.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
  name: quota
spec:
  hard:
    cpu: "4"
    memory: 6G
    pods: "10"
    replicationcontrollers: "3"
    services: "5"
    configmaps: "5"

However, later when using examples. It's run against a quota with only a memory limit.

First, it attempts to create a pod with no limits. So the error message is

$ kubectl apply -f pod.yaml
Error from server (Forbidden): error when creating "pod.yaml": pods "nginx-pod" is forbidden: failed quota: quota: must specify memory

This is wrong, the error message must mention that both memory and cpu must be specified.

failed quota: quota: must specify cpu,memory

The tutorial then mentions we should use a memory limit. It should mention that we need to specify both a CPU and a memory limit.

The error message indicates that a ResourceQuota is in effect, and that the Pod must explicitly specify memory resources.

Later, a pod with a memory limit is created. This does not work with the quota from the previous step because it only has a memory limit and no CPU limit.

Under Get more details about the ResourceQuota: the output of kubectl describe quota/quota says 400m in front of CPU. It should be 1.

This line explains due to a bug in Kubernetes, we do not need to specify both a CPU and a memory limit.
* kubernetes#55433 provide more details on how an explicit CPU resource is not needed to create a Pod with ResourceQuota.

kubernetes/kubernetes#55433 appears to have been fixed. I tried on the latest AWS EKS and we need both CPU and memory limit in the pod.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant