<p>If I have a <code>CronJob</code> the has <code>requests.memory</code> of, let's say, <code>100Mi</code>, when the pod finishes and enter on <code>Completed</code> state, does it still "reserves" that amount of memory, or are the requested resources freed up?</p>

<p>Both <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/" rel="noreferrer">Jobs docs</a> and <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/" rel="noreferrer">Pod Lifecycle docs</a> don't specify what happens after the pods in on <code>Completed</code> phase.</p>

caarlos0
<p>Nope, Kubernetes no more reserves memory or CPU once <em>Pods</em> are marked <em>completed</em>.</p>

<p>Providing you this example using a local <code>minikube</code> instance.</p>

<h1>the Job manifest</h1>

<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  creationTimestamp: null
  name: test-job
spec:
  template:
    metadata:
      creationTimestamp: null
    spec:
      containers:
      - command:
        - date
        image: busybox
        name: test-job
        resources:
          requests:
            memory: 200Mi
      restartPolicy: Never
status: {}
</code></pre>

<h1>the Node describe output</h1>

<pre><code># kubectl describe node|grep -i mem -C 5
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests     Limits
  --------           --------     ------
  cpu                755m (37%)   0 (0%)
  memory             190Mi (10%)  340Mi (19%)
</code></pre>

<h1>Applying the job and then describing the node</h1>

<pre><code># kubectl create -f job.yaml &amp;&amp; kubectl describe node | grep -i mem -C 5
job.batch/test-job created
(...)
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests     Limits
  --------           --------     ------
  cpu                755m (37%)   0 (0%)
  memory             390Mi (22%)  340Mi (19%)
</code></pre>

<h1>describe again the Node after the Job completion</h1>

<pre><code># kubectl describe node | grep -i mem -C 5
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests     Limits
  --------           --------     ------
  cpu                755m (37%)   0 (0%)
  memory             190Mi (10%)  340Mi (19%)
  ephemeral-storage  0 (0%)       0 (0%)
</code></pre>
