The error CrashLoopBackOff indicates that a container is repeatedly crashing after restarting. A container might crash for many reasons
For example:
You can get more info about your error the CrashLoopBackOff error to know why your Pod's container is crashing
To see all Pods running in your cluster, run the following command:
kubectl get pods
And to get the Pod's logs, run the following command:
kubectl logs [POD_NAME]
You can also pass in the -p
flag to get the logs for the previous instance of a Pod's container, if it exists.
Check "Exit Code" of the crashed container
You can find the exit code
by performing the following tasks:
- Run the following command:
kubectl describe pod [POD_NAME]
- Review the value in the containers:
CONTAINER_NAME: last state: exit code
Additionally, check if it has restarts.
For example you can use the command
watch -n1 kubectl get pods POD_NAME
To see if the pod got some of the following states:
creatingContainer --> running --> completed --> crashloopbackoff
You could see more information about it in the following link
Also you can check this article that can help you with this issue What is a CrashLoopBackOff? How to alert, debug / troubleshoot, and fix Kubernetes CrashLoopBackOff events.
Finally, if you provide more information like the logs and more details, the community could help you more.
Edit 1
Looks like your problem come from the FROM mcr.microsoft.com/dotnet/sdk
I have found the following documentation: Create a Dockerfile for an ASP.NET Core application
You could try to use something like:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
According to the official documentation : microsoft-dotnet-sdk these are the feature tags:
docker pull mcr.microsoft.com/dotnet/sdk:5.0
docker pull mcr.microsoft.com/dotnet/sdk:3.1