Skip to content

StatefulSet does not apply resource limits #223

Open
@tmirks

Description

@tmirks

Description

Elasticsearch cluster StatefulSets are created without resource limits set. Setting the limit values appear to be commented out in the code for whatever reason.

This is a problem if you've defined a LimitRange resource in your cluster to provide a default set of limits when otherwise unspecified.

Example

Our LimitRange:

...
  kind: LimitRange
  spec:
    limits:
    - default:
        cpu: "1"
        memory: 512Mi
...

The StatefulSet is created with the following resources (notice no limits):

...
          resources:
            requests:
              cpu: 500m
              memory: 1Gi
...

The result is an error on the StatefulSet because the request is higher than the LimitRange defaults:

Invalid value: "1Gi": must be less than or equal to memory limit

Type     Reason        Age                 From                    Message
----     ------        ----                ----                    -------
Warning  FailedCreate  16s (x15 over 55s)  statefulset-controller  create Pod xxxxx-0 in StatefulSet xxxxx failed error: Pod "xxxxx-0" is invalid: spec.containers[0].resources.requests: Invalid value: "1Gi": must be less than or equal to memory limit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions