【问题标题】:Kubernetes CrashLoopBackOffKubernetes CrashLoopBackOff
【发布时间】:2021-05-21 04:52:30
【问题描述】:

创建部署时出错。 这是我在本地运行和测试的 Dockerfile,我也将它推送到 DockerHub

FROM node:14.15.4
WORKDIR /usr/src/app
COPY package*.json ./

RUN npm install
RUN npm install pm2 -g
COPY . .
EXPOSE 3001
CMD [ "pm2-runtime", "server.js" ]

在我的树莓派 3 模型 B 中,我使用 curl -sfL https://get.k3s.io | sh - 安装了 k3s 这是我的控制器-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller-deployment
  labels:
    app: controller
spec:
  replicas: 1
  selector:
    matchLabels:
      app: controller
  template:
    metadata:
      labels:
        app: controller
    spec:
      containers:
      - name: controller
        image: akirayorunoe/node-controller-server
        ports:
        - containerPort: 3001

运行此文件后 pod 报错

当我登录 pod 时,它说

standard_init_linux.go:219: exec user process caused: exec format error

这是来自describe pod的回复

Name:         controller-deployment-8669c9c864-sw8kh
Namespace:    default
Priority:     0
Node:         raspberrypi/192.168.0.30
Start Time:   Fri, 21 May 2021 11:21:05 +0700
Labels:       app=controller
              pod-template-hash=8669c9c864
Annotations:  <none>
Status:       Running
IP:           10.42.0.43
IPs:
  IP:           10.42.0.43
Controlled By:  ReplicaSet/controller-deployment-8669c9c864
Containers:
  controller:
    Container ID:   containerd://439edcfdbf49df998e3cabe2c82206b24819a9ae13500b0                                                                                        13b9bac1df6e56231
    Image:          akirayorunoe/node-controller-server
    Image ID:       docker.io/akirayorunoe/node-controller-server@sha256:e1c5115                                                                                        2f9d596856952d590b1ef9a486e136661076a9d259a9259d4df314226
    Port:           3001/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Fri, 21 May 2021 11:24:29 +0700
      Finished:     Fri, 21 May 2021 11:24:29 +0700
    Ready:          False
    Restart Count:  5
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-txm85 (ro                                                                                        )
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-txm85:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-txm85
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                    From               Message
  ----     ------     ----                   ----               -------
  Normal   Scheduled  5m33s                  default-scheduler  Successfully ass                                                                                        igned default/controller-deployment-8669c9c864-sw8kh to raspberrypi
  Normal   Pulled     5m29s                  kubelet            Successfully pul                                                                                        led image "akirayorunoe/node-controller-server" in 3.072053213s
  Normal   Pulled     5m24s                  kubelet            Successfully pul                                                                                        led image "akirayorunoe/node-controller-server" in 3.018192177s
  Normal   Pulled     5m6s                   kubelet            Successfully pul                                                                                        led image "akirayorunoe/node-controller-server" in 3.015959209s
  Normal   Pulled     4m34s                  kubelet            Successfully pul                                                                                        led image "akirayorunoe/node-controller-server" in 2.921116157s
  Normal   Created    4m34s (x4 over 5m29s)  kubelet            Created containe                                                                                        r controller
  Normal   Started    4m33s (x4 over 5m28s)  kubelet            Started containe                                                                                        r controller
  Normal   Pulling    3m40s (x5 over 5m32s)  kubelet            Pulling image "a                                                                                        kirayorunoe/node-controller-server"
  Warning  BackOff    30s (x23 over 5m22s)   kubelet            Back-off restart                                                                                        ing failed container

这里是error images

【问题讨论】:

    标签: docker kubernetes k3s


    【解决方案1】:

    您正在尝试在 ARM 机器上启动为 x86(或 x86_64,相同的区别)构建的容器。这不起作用。 ARM 容器必须专门为 ARM 构建并包含 ARM 可执行文件。虽然主要项目正在缓慢地将 ARM 支持添加到其构建中,但您在 Docker Hub 上找到的大多数随机映像或其他任何东西都无法在 ARM 上运行。

    【讨论】:

    • 谢谢,我已经通过创建多拱图像来修复它
    猜你喜欢
    • 1970-01-01
    • 2022-08-08
    • 2019-06-25
    • 2018-09-02
    • 2020-10-28
    • 2018-08-02
    • 2019-05-02
    • 1970-01-01
    • 2020-12-11
    相关资源
    最近更新 更多