<p>Whenever I create a pod the status of pod changes to 'CrashLoopBackOff' after 'Completed'.
I am using microk8s I have pushed the image to microk8s registry. I am creating a pod by running this command : &quot;kubectl create -f backend-deployment.yml&quot;</p>
<p>backend.Dockerfile( this docker file is of Django):</p>
<pre><code>From python:3
ENV PYTHONUNBUFFERED 1
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . ./
EXPOSE 8000
</code></pre>
<p>backend-deployment.yml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name : backend-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: backend
  template:
    metadata:
      labels:
        component: backend
    spec:
      containers:
        - name: backand
          image: localhost:32000/backend:latest
          ports:
          - containerPort: 8000
</code></pre>
<p>what am I doing wrong?</p>

Usama Hameed
<p>A Deployment by design will endeavour to keep all its replicas running.</p>
<p>If your pod completes, whether successfully or not, the Deployment will restart it.</p>
<p>If the Deployment detects the pod has been restarted repeatedly, it will add delays to its restart attempts, hence the <code>CrashLoopBackoff</code></p>
<p>If the pod is only supposed to run once to completion, it should be constructed as a <code>Job</code> instead.</p>
<p>Further reading: <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/job/</a></p>
