Facing Kubernetes CrashLoopBack

12/20/2019

I am trying to deploy a Python Api on Google Kubernetes Engine. But when I check kubectl get pods, it gave me "crashloopback off error".

Can anybody guide me what is error and why it is occurring

enter image description here

-- Naeem Khan
deployment
google-compute-engine
google-kubernetes-engine
kubernetes
python

3 Answers

12/20/2019

1) Receive and read the logs:

kubectl logs po/tens-app-5844fd978f-95jxl

2) Describe you pod:

kubectl describe po/tens-app-5844fd978f-95jxl
-- Arslanbekov
Source: StackOverflow

12/20/2019

It might have something to do with the Resource availability in the cluster.You can find the reason using one of these kubectl logs / kubectl describe.

Also try using Resource request and limits in your yaml (numbers are just example):

resources:
requests:
memory: "5000Mi"
cpu: "1"
limits:
memory: "8000Mi"
cpu: "2"

-- Sandeep khatri
Source: StackOverflow

12/20/2019

Since first it says Error, then CrashLoopBackOff, probably your app is crashing inside the container, so you are getting the Error, then the pod dies, since there are no processes running inside it. But as you have a deployment behind it, it re-creates the pod, so you are in a loop.

Describing the pod probably won't give you anything, as the error is because of the app.

Logs, on the other hand, will tell you what's going on. If you get the logs right after the pod gets created it will tell you what's failing.

-- suren
Source: StackOverflow