Create a namespace with your name and assigne one dummy resourcesquota to it and deploy some app
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
[centos@ip-172-31-15-134 ~]$ kubectl create ns raju
namespace/raju created
resource.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: mem-cpu-demo
spec:
hard:
requests.cpu: "1"
requests.memory: 1Gi
limits.cpu: "2"
limits.memory: 2Gi
kubectl apply -f resource.yaml -n raju
resourcequota/mem-cpu-demo created
kubectl get resourcequota mem-cpu-demo --namespace=raju
NAME AGE REQUEST LIMIT
mem-cpu-demo 2m2s requests.cpu: 0/1, requests.memory: 0/1Gi limits.cpu: 0/2, limits.memory: 0/2Gi
[centos@ip-172-31-15-134 raju]$ kubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml --namespace=raju
Error from server (Forbidden): error when creating "https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml": pods "quota-mem-cpu-demo" is forbidden: exceeded quota: mem-cpu-demo, requested: requests.memory=600Mi, used: requests.memory=700Mi, limited: requests.memory=1Gi
Got error when resource is exceeded.
Name: raju
Labels: kubernetes.io/metadata.name=raju
Annotations: <none>
Status: Active
Resource Quotas
Name: mem-cpu-demo
Resource Used Hard
-------- --- ---
limits.cpu 800m 2
limits.memory 1Gi 2Gi
requests.cpu 400m 1
requests.memory 700Mi 1Gi
No LimitRange resource.