Katiyman
Katiyman

Reputation: 846

Error creating: pods is forbidden:<pod> failed quota: <namespace>: must specify limits.memory

I created two deployments (deployment happening with a kubenetes operator and there are other activities, like service creation, secret creation etc., also there though i feel they are not related to this error) and expected for the pods to come up but pods dint come up. when I checked the events I found there is below error for both the pods(i am listing one)

60m         Warning   FailedCreate        replicaset/sast-edge-5577bdcf6c      Error creating: pods "sas-edge-5577bdcf6c-94ps9" is forbidden: failed quota: app-xxxx-stable-biw9247u7z: must specify limits.memory

When I describe pod I see that the limits have been specified

 image: registry.xxx.xxxx.com/xxkl/xxx-xxxx:1.4
        imagePullPolicy: IfNotPresent
        name: nsc-core
        ports:
        - containerPort: 3000
          protocol: TCP
        resources:
          limits:
            memory: 500Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File

I also checked the quota for the NS

Name:          app-xxxx-stable-biw9247u7z
Namespace:     app-xxxx-stable-biw9247u7z
Resource       Used    Hard
--------       ----    ----
limits.memory  4072Mi  8Gi

I am not sure why kubernetes is not the specified resource limit. Need help.

Upvotes: 3

Views: 33777

Answers (2)

Dashrath Mundkar
Dashrath Mundkar

Reputation: 9174

Add something like this under spec section

containers:
- name: nsc-core
  image: registry.xxx.xxxx.com/xxkl/xxx-xxxx:1.4
  resources:
    limits:
      cpu: "2"
      memory: 2000Mi
    requests:
      cpu: "0.2"
      memory: 1500Mi

Upvotes: 4

Arghya Sadhu
Arghya Sadhu

Reputation: 44549

Forbidden Failed quota error comes when any of the containers in the pod does not have limits and requests in the spec and that includes init containers too. Adding limits and requests to all containers should solve the error.

Upvotes: 10

Related Questions