How to fix `Exec /usr/local/bin/jupyterhub: exec format error`?

I’m trying to deploy jupyterhub with helm.

When I tried the default “k8s-hub:3.0.3” image

      name: jupyterhub/k8s-hub
      tag: "3.0.3"

It shows:

File "<string>", line 4, in <module>
    ModuleNotFoundError: No module named 'kubernetes'

I found a solution from this. I went on and created a custom hub based on this Dockerfile, which worked for that issue. However, new issue occurred when I checked the pods:

NAME                              READY   STATUS             RESTARTS       AGE
continuous-image-puller-8lwtn     1/1     Running            0              30m
continuous-image-puller-ch6mp     1/1     Running            0              30m
continuous-image-puller-zwlbn     1/1     Running            0              30m
hub-6f694f7546-9n5js              0/1     CrashLoopBackOff   10 (45s ago)   27m
proxy-6bf54598c5-b2crr            1/1     Running            0              30m
user-scheduler-6c856f48f6-87drp   1/1     Running            0              30m
user-scheduler-6c856f48f6-fbxmq   1/1     Running            0              30m

Here is the result after I described the pod:

  Type     Reason     Age                    From               Message
  ----     ------     ----                   ----               -------
  Normal   Scheduled  27m                    default-scheduler  Successfully assigned <NAMESPACE>/<POD_NAME> to <NAMESPACE>
  Normal   Pulled     26m (x4 over 27m)      kubelet            Container image <IMAGE_NAME> already present on machine
  Normal   Created    26m (x4 over 27m)      kubelet            Created container hub
  Normal   Started    26m (x4 over 27m)      kubelet            Started container hub
  Warning  BackOff    2m53s (x131 over 27m)  kubelet            Back-off restarting failed container hub in pod <POD_NAME>

And the logs of the pod kubectl logs <HUB_POD_NAME> --namespace <NAMESPACE>:

exec /usr/local/bin/jupyterhub: exec format error` 

My approach so far have been rebuild and custom hub with buildx or add --platform linux/amd64 to build (I use a Mac M1) but it didn’t work.

Any helps are appreciated!

The default Z2JH configuration should work with amd64 and arm64.

Which version of Z2JH are you using? Can you show us your full configuration, show us how you’re installing Z2JH, and how you’ve setup your K8s cluster?