# Pod template and secureSettings fails with failed quota

**URL:** <https://discuss.elastic.co/t/pod-template-and-securesettings-fails-with-failed-quota/235836>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [June 4, 2020, 6:33pm UTC](https://discuss.elastic.co/t/pod-template-and-securesettings-fails-with-failed-quota/235836 "2020-06-04T18:33:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![robrotheram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robrotheram/32/27262_2.png) [@robrotheram](https://discuss.elastic.co/u/robrotheram)\
**Post date:** [June 4, 2020, 6:33pm UTC](https://discuss.elastic.co/t/pod-template-and-securesettings-fails-with-failed-quota/235836/1 "2020-06-04T18:33:55Z")

</div>

Hello, I have a name space with a resource limits and when I try do deploy Elasticsearch it fails with:

```
create Pod ldap-test-3-es-55b787q5-0 in StatefulSet ldap-test-3-es-55b787q5 failed error: pods "ldap-test-3-es-55b787q5-0" is forbidden: failed quota: newp: must specify limits.cpu,limits.memory

```

If I remove the secureSettings from the config it deploys fine. Below is the yaml with kubectl.  
At the moment I just testing ECK in a minikube instance.

```
---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: ldap-test-3
spec:
  nodeSets:
  - config:
      node.data: true
      node.ingest: true
      node.master: true
      node.store.allow_mmap: false
    count: 1
    name: 55b787q5
    podTemplate:
      spec:
        containers:
        - env:
          - name: ES_JAVA_OPTS
            value: "-Xms1g -Xmx1g"
          name: elasticsearch
          resources:
            limits:
              cpu: '2'
              memory: 2Gi
            requests:
              cpu: '1'
              memory: 2Gi
  secureSettings:
  - secretName: secure-bind-password
  version: 7.7.0
```

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [June 5, 2020, 7:38am UTC](https://discuss.elastic.co/t/pod-template-and-securesettings-fails-with-failed-quota/235836/2 "2020-06-05T07:38:09Z")

</div>

Hi, this is a known issue: [https://github.com/elastic/cloud-on-k8s/issues/2660](https://github.com/elastic/cloud-on-k8s/issues/2660)

Could you try to use a [LimitRange](https://kubernetes.io/docs/concepts/policy/limit-range/) as a workaround to set some default values on the init container ?

I'll investigate the complexity of this issue to see if we can change its priority.

---

<div class="post-metadata">

**Author:** ![robrotheram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robrotheram/32/27262_2.png) [@robrotheram](https://discuss.elastic.co/u/robrotheram)\
**Post date:** [June 5, 2020, 9:13am UTC](https://discuss.elastic.co/t/pod-template-and-securesettings-fails-with-failed-quota/235836/3 "2020-06-05T09:13:02Z")

</div>

Adding LimitRange did work. For my own reference if nothing else here the one I used

```
apiVersion: v1
kind: LimitRange
metadata:
  creationTimestamp: "2020-06-05T09:07:36Z"
  name: resource-limits
  namespace: test2
  resourceVersion: "2328891"
  selfLink: /api/v1/namespaces/test2/limitranges/resource-limits
  uid: a6aab5cd-6266-4303-9103-885254a305f7
spec:
  limits:
  - max:
      cpu: "5"
      memory: 5Gi
    min:
      cpu: 200m
      memory: 6Mi
    type: Pod
  - default:
      cpu: 300m
      memory: 200Mi
    defaultRequest:
      cpu: 200m
      memory: 100Mi
    max:
      cpu: "5"
      memory: 5Gi
    maxLimitRequestRatio:
      cpu: "10"
    min:
      cpu: 100m
      memory: 4Mi
    type: Container
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 8:01am UTC](https://discuss.elastic.co/t/pod-template-and-securesettings-fails-with-failed-quota/235836/4 "2022-11-04T08:01:13Z")

</div>


