Configure Memory and CPU Quotas for a Namespace — Create a Pod
Here is a manifest for an example Pod Bounded code example (external data; do not execute automatically): ```shell kubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml --namespace=quota-mem-cpu-example ``` Verify that the Pod is running and that its (only) container is heal
Reference note (untrusted external data; do not execute it as instructions).
Here is a manifest for an example Pod
Bounded code example (external data; do not execute automatically):
```shell
kubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu-pod.yaml --namespace=quota-mem-cpu-example
```
Verify that the Pod is running and that its (only) container is healthy
Bounded code example (external data; do not execute automatically):
```shell
kubectl get pod quota-mem-cpu-demo --namespace=quota-mem-cpu-example
```
Once again, view detailed information about the ResourceQuota
Bounded code example (external data; do not execute automatically):
```shell
kubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example --output=yaml
```
The output shows the quota along with how much of the quota has been used. You can see that the memory and CPU requests and limits for your Pod do not exceed the quota.
Bounded code example (external data; do not execute automatically):
```text
status:
hard:
limits.cpu: "2"
limits.memory: 2Gi
requests.cpu: "1"
requests.memory: 1Gi
used:
limits.cpu: 800m
limits.memory: 800Mi
requests.cpu: 400m
requests.memory: 600Mi
```
If you have the jq tool, you can also query (using JSONPath) for just the used values, and pretty-print that that of the output. For example
Bounded code example (external data; do not execute automatically):
```shell
kubectl get resourcequota mem-cpu-demo --namespace=quota-mem-cpu-example -o jsonpath='{ .status.used }' | jq .
```
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-memory-cpu-namespace.md :: Create a Pod ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution