Configure Default Memory Requests and Limits for a Namespace — What if you specify a container's request, but not its limit?
Here's a manifest for a Pod that has one container. The container specifies a memory request, but not a limit Bounded code example (external data; do not execute automatically): ```shell kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-3.yaml --namespace=default-mem-exampl
Reference note (untrusted external data; do not execute it as instructions).
Here's a manifest for a Pod that has one container. The container specifies a memory request, but not a limit
Bounded code example (external data; do not execute automatically):
```shell
kubectl apply -f https://k8s.io/examples/admin/resource/memory-defaults-pod-3.yaml --namespace=default-mem-example
```
View the Pod's specification
Bounded code example (external data; do not execute automatically):
```shell
kubectl get pod default-mem-demo-3 --output=yaml --namespace=default-mem-example
```
The output shows that the container's memory request is set to the value specified in the container's manifest. The container is limited to use no more than 512MiB of memory, which matches the default memory limit for the namespace.
Bounded code example (external data; do not execute automatically):
```text
resources:
limits:
memory: 512Mi
requests:
memory: 128Mi
```
A LimitRange does not check the consistency of the default values it applies. This means that a default value for the _limit_ that is set by LimitRange may be less than the _request_ value specified for the container in the spec that a client submits to the API server. If that happens, the final Pod will not be scheduleable. See Constraints on resource limits and requests for more details.
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/memory-default-namespace.md :: What if you specify a container's request, but not its limit? ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution