Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
480 views
in Technique[技术] by (71.8m points)

kubernetes - Unable to create namespace quota using helm

I am facing the following issue related specifying namespace quota.

  1. namespace quota specified is not getting created via helm. My file namspacequota.yaml is as shown below
apiVersion: v1
kind: ResourceQuota
metadata:
  name: namespacequota
  namespace: {{ .Release.Namespace }}
spec:
  hard:
    requests.cpu: "3"
    requests.memory: 10Gi
    limits.cpu: "6"
    limits.memory: 12Gi

Below command used for installation

helm install privachart3 . -n test-1

However the resourcequota is not getting created.

kubectl get resourcequota -n test-1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NAME                  CREATED AT
gke-resource-quotas   2021-01-20T06:14:16Z
  1. I can define the resource-quota using the below kubectl command.

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

The only change required in the file above is commenting of line number-5 that consist of release-name.

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

However in this case, when i am trying to install the chart, the PVC is created, but the POD is not getting created.

The capacity is not an issue as i am just trying to create a single maria-db pod using "Deployment".

Command used for install given below

helm install chart3 . -n test-1

Output observed given below

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NAME: chart3
LAST DEPLOYED: Sat Jan 23 08:38:50 2021
NAMESPACE: test-1
STATUS: deployed
REVISION: 1
TEST SUITE: None
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
question from:https://stackoverflow.com/questions/65857672/unable-to-create-namespace-quota-using-helm

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I got the answer from another the Git forum. Upon setting a namespace quota we need to explicitly set the POD's resource. In my case i just needed to specify the resource limit under the image.

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

Post that i am now able to observe the PODs as well

[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 ]$ 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...