Specify Resources#

In this lab you will build on the pod definition from the last lab, Make a Pod and Service for Django, by adding a resource definition. Every pod should ask for the resources it needs to ensure the Kubernetes scheduler works properly.

Tip

You can find examples of resource limits in the Kubernetes documentation.

Resource Limits#

The code fragment below limits the Django container to the following.

  1. CPU: 250m (250 milli-cpus or 0.25 of a CPU)

  2. Memory: 512Mi (255 Mebi-bytes \(256 * 2^{20}\) bytes)

  3. Storage: 10Mi (10 Mebi-bytes of disk sapce \(10 * 2^{20}\) byts)

Add this to the container definition in deployment/mysite-pod.yaml:

resources:
  limits:
    cpu: 250m 
    memory: 512Mi
    ephemeral-storage: 10Mi