【问题标题】:Unable to create namespace quota using helm无法使用 helm 创建命名空间配额
【发布时间】:2021-04-27 15:48:55
【问题描述】:

我面临以下与指定命名空间配额相关的问题。

  1. 指定的命名空间配额不是通过 helm 创建的。 我的文件 namspacequota.yaml 如下图所示
apiVersion: v1
kind: ResourceQuota
metadata:
  name: namespacequota
  namespace: {{ .Release.Namespace }}
spec:
  hard:
    requests.cpu: "3"
    requests.memory: 10Gi
    limits.cpu: "6"
    limits.memory: 12Gi

以下用于安装的命令

helm install privachart3 . -n test-1

但是没有创建资源配额。

kubectl get resourcequota -n test-1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NAME                  CREATED AT
gke-resource-quotas   2021-01-20T06:14:16Z
  1. 我可以使用以下 kubectl 命令定义资源配额。

kubectl apply -f namespacequota.yaml --namespace=test-1

上述文件中唯一需要的更改是注释由 release-name 组成的第 5 行。

kubectl get resourcequota -n test-1
NAME                   CREATED AT
gke-resource-quotas    2021-01-20T06:14:16Z
namespacequota         2021-01-23T07:30:27Z

但是在这种情况下,当我尝试安装图表时,会创建 PVC,但没有创建 POD。

容量不是问题,因为我只是尝试使用“部署”创建单个 maria-db pod。

下面给出的安装命令

helm install chart3 . -n test-1

观察到的输出如下

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NAME: chart3
LAST DEPLOYED: Sat Jan 23 08:38:50 2021
NAMESPACE: test-1
STATUS: deployed
REVISION: 1
TEST SUITE: None
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

【问题讨论】:

  • 我对你的问题有点困惑。是报价资源未创建还是 pod 未能创建?
  • 1.配额不是通过“helm install 命令”创建的。 2. 当我通过“kubectl”命令手动创建 qouta,然后尝试安装图表时,不会创建 pod,
  • 你把yaml文件放到templates文件夹了吗?
  • 使用helm upgrade--debug 并观察它显示的内容。
  • @VasiliAngapov,是的,我确实错过了这一点,并发布了更正我的资源配额是使用“helm install 命令”创建的。

标签: kubernetes kubernetes-helm quota


【解决方案1】:

我从另一个 Git 论坛得到了答案。 设置命名空间配额后,我们需要显式设置 POD 的资源。 在我的情况下,我只需要指定图像下的资源限制。

  - image: wordpress:4.8-apache
    resources:
      requests:
        memory: "64Mi"
        cpu: "250m"
      limits:
        memory: "128Mi"
        cpu: "500m"

发布我现在也可以观察 POD 了

[george@dis ]$ kubectl get resourcequota -n geo-test
NAME                  AGE   REQUEST                                                                                                                              LIMIT

gke-resource-quotas   31h   count/ingresses.extensions: 0/100, count/ingresses.networking.k8s.io: 0/100, count/jobs.batch: 0/5k, pods: 2/1500, services: 2/500   

namespace-quota       7s    requests.cpu: 500m/1, requests.memory: 128Mi/1Gi                                                                                     limits.cpu: 1/3, limits.memory: 256Mi/3Gi
[george@dis ]$ 
.



[george@dis ]$ kubectl get pod -n geo-test

NAME                                 READY     STATUS     RESTARTS     AGE

wordpress-7687695f98-w7m5b           1/1       Running     0           32s

wordpress-mysql-7ff55f869d-2w6zs     1/1       Running     0           32s

[george@dis ]$ 

【讨论】:

    猜你喜欢
    • 2022-10-08
    • 2018-03-22
    • 1970-01-01
    • 1970-01-01
    • 2019-12-26
    • 1970-01-01
    • 1970-01-01
    • 2020-06-27
    • 1970-01-01
    相关资源
    最近更新 更多