gpt4 book ai didi

kubernetes - CrashLoopBackOff : Back-off restarting failed container

转载 作者:行者123 更新时间:2023-12-05 05:51:49 25 4
gpt4 key购买 nike

我正在尝试调试我的 pod 抛出 CrashLoopBackOff 错误。当我运行 decribe 命令时,我发现 Back-off restarting failed container 是错误。我执行了失败的 pod 的日志,并得到了以下数据。

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

为什么我无法执行日志命令?

更多详情:

enter image description here

yaml文件如下

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

我的 Vagrant 文件

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

感谢任何帮助。

最佳答案

总结评论:当 AMD64 和 ARM64 设备不匹配时,会发生 CrashLoopBackOff 错误。根据你的docker镜像udacity/nd064-udaconnect-app,我们可以看到它是AMD64 arch你的盒子 opensuse/Leap-15.2.x86_64ARM64 arch .

因此,您必须更改 docker 镜像或 box 才能解决此问题。

关于kubernetes - CrashLoopBackOff : Back-off restarting failed container,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70317904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com