Kubernetes YAML Cheat Sheet/CPU and memory requests/limits

Define scheduler reservations and hard caps.

Section: Probes and Resources

CPU and memory requests/limits

yaml
yaml
resources:
  requests:
    cpu: "250m"
    memory: "256Mi"
  limits:
    cpu: "500m"
    memory: "512Mi"
Explanation

Requests influence scheduling; limits constrain runtime resource use.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Probes and Resources
HTTP liveness, readiness, and startup probes
Use health checks to control traffic and restarts.
OpenIn sheetyamlsame section
Container securityContext
Drop privileges and run as non-root.
OpenIn sheetyamlsame section
Minimal Pod manifest
Smallest practical Pod YAML shape.
Labels and annotations example
Common metadata block for selectors and tooling.
Override container command and args
Set entrypoint-style command in YAML.
Basic Deployment YAML
Run a replicated stateless workload.