Home > database >  How can I resolve kubernetes CrashLoopBackOff problem?
How can I resolve kubernetes CrashLoopBackOff problem?

Time:12-14

I wanted to connect echo server and client. So I built images of them and pushed them to docker hub. These are Dockerfiles of them.

<server Dockerfile `

FROM docker.io/python:3.9.15
RUN apt-get update
WORKDIR /me
COPY server.py .
EXPOSE 65456
CMD ["python", "/me/server.py"]

`

<client Dockerfile `

FROM docker.io/python:3.9.15
RUN apt-get update
WORKDIR /you
COPY client.py .
EXPOSE 8080
CMD ["python", "/you/client.py"]

`

And I wrote .yaml to make a pod and connect them in k8s. This is the yaml file.

`

apiVersion: apps/v1
kind: Deployment
metadata:
  name: assign3
  labels:
    app: assign3
  
spec:
  selector:
    matchLabels:
      app: assign3-pod
  template:
    metadata:
      labels:
        app: assign3-pod
    spec:
      containers:
      - name: server
        image: docker.io//*myserverimagename/*/:1.0
        ports:
        - containerPort: 65456

      - name: client
        image: docker.io//*myclientimagename/*:1.0

`

Server is working well, but everytime I try, client leaves this message, "back-off 5m0s restarting failed container=client pod=assign3-859cf44595-clvzs_default(aed6633b-adf9-44c5-ad54-a60e8de48d20)" , and its ready and start status is fail because of "CrashLoopBackOff".

This is an event log; I found it from minikube dashboard.

(https://i.stack.imgur.com/p4msJ.png)

I tried to rebuild client image and pushed it again to docker hub, but I couldn't resolve it.... please help me smart guys..

CodePudding user response:

Please check or share the logs of the client container using kubectl command

kubectl logs <pod_name> <container_name>
  • Related