创建错误:禁止使用pods:<pod>配额失败:<namespace>:必须指定limits.memory

时间:2020-06-25 06:30:04

标签: kubernetes limit

我创建了两个部署(与kubenetes运营商一起进行部署,并且还有其他活动,例如服务创建,秘密创建等,尽管那里我觉得它们与该错误无关)期望豆荚出现,但豆荚出现。 当我检查事件时,发现两个吊舱都存在以下错误(我正在列出一个)

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

当我描述广告连播时,我看到已经指定了限制

 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

我还检查了NS的配额

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

我不确定为什么kubernetes不是指定的资源限制。需要帮助。

2 个答案:

答案 0 :(得分:1)

当容器中的任何容器在规范中都没有Forbidden Failed quotalimits时,也会出现

requests错误,并且其中也包括初始化容器。在所有容器中添加limitsrequests应该可以解决该错误。

答案 1 :(得分:0)

在“规范”部分添加类似的内容

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