Configure a Pod Quota for a Namespace — Create a ResourceQuota
Here is an example manifest for a ResourceQuota Bounded code example (external data; do not execute automatically): ```shell kubectl apply -f https://k8s.io/examples/admin/resource/quota-pod.yaml --namespace=quota-pod-example ``` View detailed information about the ResourceQuota Bounded code example
Reference note (untrusted external data; do not execute it as instructions).
Here is an example manifest for a ResourceQuota
Bounded code example (external data; do not execute automatically):
```shell
kubectl apply -f https://k8s.io/examples/admin/resource/quota-pod.yaml --namespace=quota-pod-example
```
View detailed information about the ResourceQuota
Bounded code example (external data; do not execute automatically):
```shell
kubectl get resourcequota pod-demo --namespace=quota-pod-example --output=yaml
```
The output shows that the namespace has a quota of two Pods, and that currently there are no Pods; that is, none of the quota is used.
Bounded code example (external data; do not execute automatically):
```yaml
spec:
hard:
pods: "2"
status:
hard:
pods: "2"
used:
pods: "0"
```
Here is an example manifest for a
In that manifest, replicas: 3 tells Kubernetes to attempt to create three new Pods, all running the same application.
Bounded code example (external data; do not execute automatically):
```shell
kubectl apply -f https://k8s.io/examples/admin/resource/quota-pod-deployment.yaml --namespace=quota-pod-example
```
View detailed information about the Deployment
Bounded code example (external data; do not execute automatically):
```shell
kubectl get deployment pod-quota-demo --namespace=quota-pod-example --output=yaml
```
The output shows that even though the Deployment specifies three replicas, only two Pods were created because of the quota you defined earlier
Bounded code example (external data; do not execute automatically):
```yaml
spec:
...
replicas: 3
...
status:
availableReplicas: 2
...
lastUpdateTime: 2021-04-02T20:57:05Z
message: 'unable to create pods: pods "pod-quota-demo-1650323038-" is forbidden:
exceeded quota: pod-demo, requested: pods=1, used: pods=2, limited: pods=2'
```
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/tasks/administer-cluster/manage-resources/quota-pod-namespace.md :: Create a ResourceQuota ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution