<p>I am a beginner in kubernetes and was trying to deploy my flask application following this guide: <a href="https://medium.com/analytics-vidhya/build-a-python-flask-app-and-deploy-with-kubernetes-ccc99bbec5dc" rel="nofollow noreferrer">https://medium.com/analytics-vidhya/build-a-python-flask-app-and-deploy-with-kubernetes-ccc99bbec5dc</a></p>
<p>I have successfully built a docker image and pushed it to dockerhub <a href="https://hub.docker.com/repository/docker/beatrix1997/kubernetes_flask_app" rel="nofollow noreferrer">https://hub.docker.com/repository/docker/beatrix1997/kubernetes_flask_app</a></p>
<p>but am having trouble debugging a pod.
This is my yaml file:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: kubernetesflaskapp-deploy
  labels:
    app: kubernetesflaskapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kubernetesflaskapp
  template:
    metadata:
      labels:
        app: kubernetesflaskapp
    spec:
      containers:
      - name: kubernetesflaskapp
        image: beatrix1997/kubernetes_flask_app
        ports:
        - containerPort: 5000
</code></pre>
<p>And this is the description of the pod:</p>
<pre><code>Name:         kubernetesflaskapp-deploy-5764bbbd44-8696k
Namespace:    default
Priority:     0
Node:         minikube/192.168.49.2
Start Time:   Fri, 20 May 2022 11:26:33 +0100
Labels:       app=kubernetesflaskapp
              pod-template-hash=5764bbbd44
Annotations:  &lt;none&gt;
Status:       Running
IP:           172.17.0.12
IPs:
  IP:           172.17.0.12
Controlled By:  ReplicaSet/kubernetesflaskapp-deploy-5764bbbd44
Containers:
  kubernetesflaskapp:
    Container ID:   docker://d500dc15e389190670a9273fea1d70e6bd6ab2e7053bd2480d114ad6150830f1
    Image:          beatrix1997/kubernetes_flask_app
    Image ID:       docker-pullable://beatrix1997/kubernetes_flask_app@sha256:1bfa98229f55b04f32a6b85d72860886abcc0f17295b14e173151a8e4b0f0334
    Port:           5000/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Fri, 20 May 2022 11:58:38 +0100
      Finished:     Fri, 20 May 2022 11:58:38 +0100
    Ready:          False
    Restart Count:  11
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-zq8n7 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  kube-api-access-zq8n7:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       &lt;nil&gt;
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              &lt;none&gt;
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                    From               Message
  ----     ------     ----                   ----               -------
  Normal   Scheduled  33m                    default-scheduler  Successfully assigned default/kubernetesflaskapp-deploy-5764bbbd44-8696k to minikube
  Normal   Pulled     33m                    kubelet            Successfully pulled image &quot;beatrix1997/kubernetes_flask_app&quot; in 14.783413947s
  Normal   Pulled     33m                    kubelet            Successfully pulled image &quot;beatrix1997/kubernetes_flask_app&quot; in 1.243534487s
  Normal   Pulled     32m                    kubelet            Successfully pulled image &quot;beatrix1997/kubernetes_flask_app&quot; in 1.373217701s
  Normal   Pulling    32m (x4 over 33m)      kubelet            Pulling image &quot;beatrix1997/kubernetes_flask_app&quot;
  Normal   Created    32m (x4 over 33m)      kubelet            Created container kubernetesflaskapp
  Normal   Pulled     32m                    kubelet            Successfully pulled image &quot;beatrix1997/kubernetes_flask_app&quot; in 1.239794774s
  Normal   Started    32m (x4 over 33m)      kubelet            Started container kubernetesflaskapp
  Warning  BackOff    3m16s (x138 over 33m)  kubelet            Back-off restarting failed container
</code></pre>
<p>I am using ubuntu as my OS if it matters at all.
Any help would be appreciated!
Many thanks!</p>

Beatrix
<p>I would check the following:</p>
<ol>
<li>Check if your Docker image works in Docker, you can run it with the <code>run</code> command, find the official doc <a href="https://docs.docker.com/engine/reference/commandline/run/" rel="nofollow noreferrer">here</a></li>
<li>If it doesn't work, then you can check what is wrong in your app first.</li>
<li>If it does, try checking the readiness and liveness probe, here the official <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">documentation</a></li>
<li>You can find more hints about failing pods <a href="https://kubernetes.io/docs/tasks/debug/debug-application/determine-reason-pod-failure/" rel="nofollow noreferrer">here</a></li>
</ol>
