<p>I wrote a k8s deployment yml sample, but it failed every time I apply it to the cluster, the logs is that</p>
<blockquote>
<p>standard_init_linux.go:228: exec user process caused: exec format error</p>
</blockquote>
<p>the yml file is as follows, I am new to kubernetes, and stuck here now, wish you could help me</p>
<pre><code>apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: nub1
spec:
  selector:
    matchLabels:
      app: nub1
      tier: backend
  replicas: 1
  template:
    metadata:
      labels:
        app: nub1
        tier: backend
    spec:
      containers:
        - name: nub1
          image: johnhaha/nub1:latest
          ports:
            - containerPort: 3001
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
</code></pre>
<p>the docker build file is</p>
<pre><code>FROM node:lts
ADD index.js /index.js
CMD node index.js
</code></pre>

John Wu
<p><code>exec format error</code> means you're trying to run a binary on a platform other than the one for which it was compiled. Looking at your image, it appears the binaries are built for an ARM platform:</p>
<pre><code>$ file bash
bash: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=29b2624b1e147904a979d91daebc60c27ac08dc6, stripped
</code></pre>
<p>Your Kubernetes environment is probably an x86_64 environment and won't be able to run your ARM binaries. The <code>docker buildx</code> command (see <a href="https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images" rel="nofollow noreferrer">the docs</a>) is able to build multi-platform images, so that may be something worth investigating.</p>
<hr />
<p>You need to build a Docker image appropriate for the platform on which you will be running it.</p>
