创建错误:pod 被禁止:<pod> 配额失败:<namespace>:必须指定限制。内存

Kat*_*man 3 limit kubernetes

我创建了两个部署(部署是由 kubenetes 操作员进行的,还有其他活动,例如服务创建、秘密创建等,尽管我觉得它们与此错误无关),并且预计pod 会出现,但 pod 没有作用过来。当我检查事件时,我发现两个 Pod 都出现以下错误(我列出了一个)

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
Run Code Online (Sandbox Code Playgroud)

当我描述 pod 时,我看到已经指定了限制

 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
Run Code Online (Sandbox Code Playgroud)

我还检查了 NS 的配额

Name:          app-xxxx-stable-biw9247u7z
Namespace:     app-xxxx-stable-biw9247u7z
Resource       Used    Hard
--------       ----    ----
limits.memory  4072Mi  8Gi
Run Code Online (Sandbox Code Playgroud)

我不确定为什么 kubernetes 没有指定资源限制。需要帮忙。

Arg*_*dhu 9

Forbidden Failed quota当 pod 中的任何容器在规范中没有limits并且也包括 init 容器时,就会出现错误。requestslimits和添加requests到所有容器应该可以解决该错误。