Skip to content

Container and pod resource limits #168

Description

@bgrant0607

Before we implement QoS tiers (#147), we need to support basic resource limits for containers and pods. All resource values should be integers.

For inspiration, see lmctfy:
https://github.com/google/lmctfy/blob/master/include/lmctfy.proto

Arguably we should start with pods first, to at least provide isolation between pods. However, that would require the ability to start Docker containers within cgroups. The support we need for individual containers already exists.

We should allow both minimum and maximum resource values to be provided, as lmctfy does. But let's not reuse lmctfy's limit and max_limit terminology. I like "requested" (amount scheduler will use for placement) and "limit" (hard limit beyond which the pod/container is throttled or killed).

Even without limit enforcement, the scheduler could use resource information for placement decisions.

Activity

  1. timothysc commented on Jul 8, 2014

    @timothysc
    Contributor

    +1.

  2. bgrant0607 commented on Jul 11, 2014

    @bgrant0607
    MemberAuthor

    We have cpu and memory in the container manifest:
    // Optional: Defaults to unlimited.
    Memory int yaml:"memory,omitempty" json:"memory,omitempty"
    // Optional: Defaults to unlimited.
    CPU int yaml:"cpu,omitempty" json:"cpu,omitempty"

    However, AFAICT, we don't do anything with them. Besides, I think we want something more similar to lmctfy's API (request, limit, qos for each resource).

    Another consideration: We could make it fairly easy to add new resources. Kubelet needs to understand each individual resource's characteristics, for isolation, QoS, overcommitment, etc. OTOH, the scheduler could deal with resources entirely abstractly. It could get resources and their capacities from the machines. Similarly, we'd need to make it possible to request abstract resources in the container/pod manifest.

  3. thockin commented on Jul 11, 2014

    @thockin
    Member

    What we described internally was that "common" resources like CPU, memory,
    disk, etc were described as first-class things. Other resources are
    handled essentially as opaque counters. E.g. a node says "I have 5
    resources with ID 12345", a client says "I need 2 resources with ID 12345".
    The scheduler maps them.

    On Fri, Jul 11, 2014 at 2:04 PM, bgrant0607 notifications@github.com
    wrote:

    We have cpu and memory in the container manifest:
    // Optional: Defaults to unlimited.
    Memory int yaml:"memory,omitempty" json:"memory,omitempty"
    // Optional: Defaults to unlimited.
    CPU int yaml:"cpu,omitempty" json:"cpu,omitempty"

    However, AFAICT, we don't do anything with them. Besides, I think we want
    something more similar to lmctfy's API (request, limit, qos for each
    resource).

    Another consideration: We could make it fairly easy to add new resources.
    Kubelet needs to understand each individual resource's characteristics, for
    isolation, QoS, overcommitment, etc. OTOH, the scheduler could deal with
    resources entirely abstractly. It could get resources and their capacities
    from the machines. Similarly, we'd need to make it possible to request
    abstract resources in the container/pod manifest.

    Reply to this email directly or view it on GitHub
    #168 (comment)
    .

  4. erictune commented on Jul 15, 2014

    @erictune
    Contributor

    Consider that the resource types and units used for pod/container requests could also be used for describing how to subdivide cluster resources (see #442 ). For example, if team A is limited to using 10GB RAM at the cluster level, then team A can run 10 pods x 1GB RAM; or 2 pods x 5GB per pod; or some combination, etc.

  5. adam-mesos commented on Jul 30, 2014

    @adam-mesos

    +1 to all of this. Mesos has a very similar model, with the scheduler/allocator able to work with any custom resource, but the slave/containerizer needs to know enough details to map it to an isolator. This would also be the appropriate separation for requested resource vs. resource limits.

  6. added this to the v1.0 milestone on Aug 27, 2014
  7. modified the milestones: , v1.0 on Sep 24, 2014
  8. modified the milestones: , on Sep 26, 2014
  9. bgrant0607 commented on Oct 2, 2014

    @bgrant0607
    MemberAuthor

    /cc @johnwilkes @davidopp @rjnagal @smarterclayton @brendandburns @thockin

    The resource model doc has been created. We should align our API with it. v1beta3 leaves resource requests unchanged, though the ResourceList type was added in order to represent node capacity. We could either add the new fields in a backwards-compatible way, or replace the existing Container Memory and CPU fields in v1beta3 -- if we prefer to do the latter, we should add this issue to #1519.

    I propose that we add an optional ResourceSpec struct containing optional Request and Limit ResourceList fields to both PodSpec and Container.

  10. 52 remaining items

  11. montanaflynn commented on Sep 12, 2016

    @montanaflynn

    Thanks! Will container engine be using that image by default in the future?

  12. vishh commented on Sep 12, 2016

    @vishh
    Contributor

    Yes. That might happen as early as v1.4 on GKE.

  13. timothysc commented on Dec 7, 2016

    @timothysc
    Contributor

    I think we should move to close this issue, the root topic has been addressed but there are multiple side-threads that are on this issue where I believe they would be better served on other issues.

    @vishh thoughts?

  14. derekwaynecarr commented on Dec 7, 2016

    @derekwaynecarr
    Member
  15. added a commit that references this issue on Feb 6, 2018
  16. maicohjf commented on Mar 24, 2019

    @maicohjf

    Before we implement QoS tiers (#147), we need to support basic resource limits for containers and pods. All resource values should be integers.

    For inspiration, see lmctfy:
    https://github.com/google/lmctfy/blob/master/include/lmctfy.proto

    Arguably we should start with pods first, to at least provide isolation between pods. However, that would require the ability to start Docker containers within cgroups. The support we need for individual containers already exists.

    We should allow both minimum and maximum resource values to be provided, as lmctfy does. But let's not reuse lmctfy's limit and max_limit terminology. I like "requested" (amount scheduler will use for placement) and "limit" (hard limit beyond which the pod/container is throttled or killed).

    Even without limit enforcement, the scheduler could use resource information for placement decisions.

    #168 (comment)

    Schedule a Pod as follows:
     Name: nginx-kusc00101
     Image: nginx
     Node selector: disk=ssd

    apiVersion: v1
    kind: Pod
    metadata:
    name: nginx-kusc00101
    spec:
    containers:
    - name: nginx-kusc00101
    image: nginx
    nodeSelector:
    disk: ssd

    kubectl create -f nginx-kusc00101.yaml

  17. added a commit that references this issue on Jun 10, 2019
  18. added a commit that references this issue on Jul 21, 2020
  19. added a commit that references this issue on Feb 5, 2021
    3740b01
  20. added a commit that references this issue on Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/apiIndicates an issue on api area.area/isolationpriority/backlogHigher priority than priority/awaiting-more-evidence.sig/nodeCategorizes an issue or PR as relevant to SIG Node.sig/schedulingCategorizes an issue or PR as relevant to SIG Scheduling.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions