<p>I've setup a small Kubernetes cluster at home using 4 RPIs.
Now I'm at the step where I want to try and deploy some stuff to it but it's not working.</p>

<p>I've created a small Flask application for testing purposes:</p>

<pre><code>from flask import Flask
app = Flask(__name__)
@app.route("/")
def test():
    return {"Hello": "World"}
if __name__ == "__main__":
    app.run(debug=True, host="0.0.0.0")
</code></pre>

<p>The Dockerfile for it:</p>

<pre><code>FROM python:3.8-alpine
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
CMD ["python", "app.py"]
</code></pre>

<p>I'm building it and pushing it to a registry in DockerHub.</p>

<p>Then I'm setting up a deployment.yaml file:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-api
spec:
  replicas: 3
  selector:
    matchLabels:
      app: test-api
  template:
    metadata:
      labels:
        app: test-api
    spec:
      containers:
        - name: test-api
          image: gurkmeja101/pi:latest
          resources:
            limits:
              memory: "128Mi"
              cpu: "500m"
          ports:
            - containerPort: 5000

---
apiVersion: v1
kind: Service
metadata:
  name: test-api
spec:
  selector:
    app: test-api
  ports:
    - port: 5000
      targetPort: 5000
  type: NodePort
</code></pre>

<p>Running <code>kubectl apply -f deployment.yaml</code> I get the following outputs:</p>

<pre><code>deployment.apps/test-api created
service/test-api created

PS C:\projects\Python\test&gt; kubectl get svc
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes   ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP          40h
test-api     NodePort    10.105.100.68   &lt;none&gt;        5000:31409/TCP   45s
PS C:\projects\Python\test&gt; kubectl get deployments
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
test-api   0/3     3            0           50s
PS C:\projects\Python\test&gt; kubectl get pods
NAME                        READY   STATUS             RESTARTS   AGE
test-api-649b447666-97x2r   0/1     CrashLoopBackOff   3          88s
test-api-649b447666-bmmld   0/1     CrashLoopBackOff   3          88s
test-api-649b447666-scnzz   0/1     CrashLoopBackOff   3          88s

</code></pre>

<p>Describing a failed pod gives me:</p>

<pre><code>Name:         test-api-649b447666-97x2r
Namespace:    default
Priority:     0
Node:         k8s-worker-02/192.168.1.102
Start Time:   Wed, 18 Mar 2020 09:05:34 +0100
Labels:       app=test-api
              pod-template-hash=649b447666
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.244.2.18
IPs:
  IP:           10.244.2.18
Controlled By:  ReplicaSet/test-api-649b447666
Containers:
  test-api:
    Container ID:   docker://1418404c27fc5a1a8ef7b557c495a7fbf8f8907ef1dd4d09b4ad5dae02d98b33
    Image:          gurkmeja101/pi:latest
    Image ID:       docker-pullable://gurkmeja101/pi@sha256:c2bca364aab8f583c3ed0e64514112475d3e8c77f5dfab979929c5e4b8adb43b
    Port:           5000/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Wed, 18 Mar 2020 09:07:10 +0100
      Finished:     Wed, 18 Mar 2020 09:07:10 +0100
    Ready:          False
    Restart Count:  4
    Limits:
      cpu:     500m
      memory:  128Mi
    Requests:
      cpu:        500m
      memory:     128Mi
    Environment:  &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-7rmwv (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-7rmwv:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-7rmwv
    Optional:    false
QoS Class:       Guaranteed
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                  From                    Message
  ----     ------     ----                 ----                    -------
  Normal   Scheduled  119s                 default-scheduler       Successfully assigned default/test-api-649b447666-97x2r to k8s-worker-02
  Normal   Pulled     24s (x5 over 116s)   kubelet, k8s-worker-02  Container image "gurkmeja101/pi:latest" already present on machine
  Normal   Created    24s (x5 over 116s)   kubelet, k8s-worker-02  Created container test-api
  Normal   Started    23s (x5 over 115s)   kubelet, k8s-worker-02  Started container test-api
  Warning  BackOff    21s (x10 over 112s)  kubelet, k8s-worker-02  Back-off restarting failed container
</code></pre>

<p>I can run the container without any issues using <code>docker run -d -p 5000:5000 pi:latest</code>.</p>

<p>Any and all help regarding this is greatly appreciated!</p>

<p><strong>logs</strong>
running <code>kubectl logs test-api-649b447666-97x2r</code>results in:
<code>standard_init_linux.go:211: exec user process caused "exec format error"</code></p>

Gurkang
<p>RaspberryPis use ARM CPUs. Your container images are built for x86_64. These are not compatible. You'll need to specifically build your images for ARM. There are many ways to do that, Docker's official tool is <code>buildx</code> I think. Check out <a href="https://www.docker.com/blog/multi-arch-images/" rel="nofollow noreferrer">https://www.docker.com/blog/multi-arch-images/</a> for their guide or just search around if you want to use a different toolchain.</p>
