codeX
codeX

Reputation: 5408

CrashLoopBackOff : Back-off restarting failed container

I am trying to debug my pod throwing CrashLoopBackOff error. When I run decribe command, I found that Back-off restarting failed container is the error. I excuted the logs for the failing pod and I got the below data.

vagrant@master:~> kubectl logs pod_name
standard_init_linux.go:228: exec user process caused: exec format error

vagrant@master:/vagrant> kubectl logs -p  pod_name
unable to retrieve container logs for containerd://db0f2dbd549676d8bf1026e5757ff45847c62152049b36037263f81915e948eavagrant

Why I am not able to execute the logs command?

More details:

enter image description here

yaml file is as follows

apiVersion: v1
kind: Service
metadata:
  labels:
    service: udaconnect-app
  name: udaconnect-app
spec:
  ports:
  - name: "3000"
    port: 3000
    targetPort: 3000
    nodePort: 30000
  selector:
    service: udaconnect-app
  type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: udaconnect-app
  name: udaconnect-app
spec:
  replicas: 1
  selector:
    matchLabels:
      service: udaconnect-app
  template:
    metadata:
      labels:
        service: udaconnect-app
    spec:
      containers:
      - image: udacity/nd064-udaconnect-app:latest
        name: udaconnect-app
        imagePullPolicy: Always
        resources:
          requests:
            memory: "128Mi"
            cpu: "64m"
          limits:
            memory: "256Mi"
            cpu: "256m"
      restartPolicy: Always

My vagrant file

default_box = "opensuse/Leap-15.2.x86_64" 
Vagrant.configure("2") do |config|
config.vm.define "master" do |master|
    master.vm.box = default_box
    master.vm.hostname = "master"
    master.vm.network 'private_network', ip: "192.168.0.200",  virtualbox__intnet: true
    master.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", disabled: true
    master.vm.network "forwarded_port", guest: 22, host: 2000 # Master Node SSH
    master.vm.network "forwarded_port", guest: 6443, host: 6443 # API Access
    for p in 30000..30100 # expose NodePort IP's
      master.vm.network "forwarded_port", guest: p, host: p, protocol: "tcp"
      end
    master.vm.provider "virtualbox" do |v|
      v.memory = "3072"
      v.name = "master"
      end
    master.vm.provision "shell", inline: <<-SHELL
      sudo zypper refresh
      sudo zypper --non-interactive install bzip2
      sudo zypper --non-interactive install etcd
      sudo zypper --non-interactive install apparmor-parser
      curl -sfL https://get.k3s.io | sh -
    SHELL
  end

  config.vm.provider "virtualbox" do |vb|
  vb.memory = "4096"
      vb.cpus = 4
end

Any help is appreciated.

Upvotes: 4

Views: 5865

Answers (1)

Bazhikov
Bazhikov

Reputation: 841

Summarizing the comments: CrashLoopBackOff error occurs, when there is a mismatch of AMD64 and ARM64 devices. According to your docker image udacity/nd064-udaconnect-app, we can see that it's AMD64 arch and your box opensuse/Leap-15.2.x86_64 is ARM64 arch.

Hence, you have to change either your docker image, or the box in order to resolve this issue.

Upvotes: 2

Related Questions