Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.
This repository was 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

Description

@parsiya

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions