librespeed / speedtest-go

Go backend for LibreSpeed
GNU Lesser General Public License v3.0
706 stars 153 forks source link

Container version not starting #16

Closed 2fst4u closed 3 years ago

2fst4u commented 3 years ago

Description

Unable to run the docker container

Server

Raspberry pi 3B running K3S

Client

Chrome on Android (works fine using the regular librespeed version)

Steps to reproduce

Following the regular librespeed docker instructions I have a working install, however it's slow because of the PHP. In switching over to this version I have just changed the image line in my kubernetes deployment yaml file to pull this version, however the container doesn't pull and start.

Expected behaviour

Container should pull and run.

This is my deployment yaml:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: librespeed-deployment
  labels:
    app: librespeed
spec:
  replicas: 1
  selector:
    matchLabels:
      app: librespeed
  template:
    metadata:
      labels:
        app: librespeed
    spec:
      containers:
      - name: librespeed
        image: mickkael/librespeed-go
        ports:
          - containerPort: 80
        resources:
          requests:
            memory: 800Mi
            cpu: 2000m
          limits:
            memory: 800Mi
            cpu: 2000m
      priorityClassName: high-priority
---
kind: Service
apiVersion: v1
metadata:
  name: librespeed-service
spec:
  type: NodePort
  selector:
    app: librespeed
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
    nodePort: 30009

And this is the output I get when checking events:

10m Normal Scheduled pod/librespeed-deployment-768fd648b9-mt65r Successfully assigned prod/librespeed-deployment-768fd648b9-mt65r to k3s-node1 9m53s Normal Pulled pod/librespeed-deployment-768fd648b9-mt65r Successfully pulled image "mickkael/librespeed-go" 9m52s Normal Created pod/librespeed-deployment-768fd648b9-mt65r Created container librespeed 9m52s Normal Started pod/librespeed-deployment-768fd648b9-mt65r Started container librespeed 9m3s Normal Pulling pod/librespeed-deployment-768fd648b9-mt65r Pulling image "mickkael/librespeed-go" 34s Warning BackOff pod/librespeed-deployment-768fd648b9-mt65r Back-off restarting failed container

Any ideas what I might be doing wrong?

mickkael commented 3 years ago

Hi, Try to remove the resources request, and keep limit only

2fst4u commented 3 years ago

Request is just for reserving resources on the node, no? The limit will remain the upper limit of available resources regardless of whether there is a request or not.

I gave it a try anyway and still no change I'm afraid. The previous pod attempt terminated and the image pulled again, but it fails to start.

mickkael commented 3 years ago

I have the container running very well on k3s 1.17 / 1.18 for a long time, on rpi 3 and 4. What do you have in the logs ? please share the output of kubectl describe deployment librespeed-deployment kubectl logs librespeed-deployment-768fd648b9-mt65r

2fst4u commented 3 years ago

Sure here they are: (note I changed the deployment name)

Name:                   librespeed-go-deployment
Namespace:              prod
CreationTimestamp:      Tue, 10 Nov 2020 23:56:36 +0000
Labels:                 app=librespeed-go
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               app=librespeed-go
Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=librespeed-go
  Containers:
   librespeed-go:
    Image:      mickkael/librespeed-go
    Port:       80/TCP
    Host Port:  0/TCP
    Limits:
      cpu:     1
      memory:  300Mi
    Requests:
      cpu:              1
      memory:           300Mi
    Environment:        <none>
    Mounts:             <none>
  Volumes:              <none>
  Priority Class Name:  high-priority
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Progressing    True    NewReplicaSetAvailable
  Available      False   MinimumReplicasUnavailable
OldReplicaSets:  <none>
NewReplicaSet:   librespeed-go-deployment-5786fc74cc (1/1 replicas created)
Events:          <none>
Standard_init_linux.go:211: exec user process caused "exec format error"

That appears to give a hint. I wasn't aware of that command.

Note though just for awareness that all other pods and deployments that I attempt to start do so without issue.

2fst4u commented 3 years ago

A bit of research shows this can sometimes happen when the image architecture is wrong?

I added ":arm64" to the image to pull and it made no change unfortunately.

mickkael commented 3 years ago

this my guess as well, and why I asked for pod logs. I have compiled the image for arm64 (latest and arm64 are the same image), and you are probably using arm32/v6 with the 32 bits version of Raspbian on your rpi3b. I personally use Ubuntu 64b on Raspberry, and it gives much better results: https://ubuntu.com/download/raspberry-pi

I can try to compile an arm32 version of the container in the next few days.

2fst4u commented 3 years ago

Ooooh man that explains it. It never clicked that raspberry OS is 32 bit. I never realised that.

If you're happy and willing to compile a 32 bit version that would be incredibly awesome of you.

mickkael commented 3 years ago

Can you try mickkael/librespeed-go:arm ?

2fst4u commented 3 years ago

No change sorry. Same error occurs.

On Thu, 12 Nov 2020, 13:24 mickkael, notifications@github.com wrote:

Can you try mickkael/librespeed-go:arm ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/librespeed/speedtest-go/issues/16#issuecomment-725740465, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNCRVS3NSWBZ7RFTTW3DLSPMTKNANCNFSM4TRH2LUQ .

2fst4u commented 3 years ago

I'm not too familiar with how Docker Hub works but I notice the "OS/arch" field for the new arm version still says "arm64". Is that a functional difference or just a metadata field?

mickkael commented 3 years ago

I actually compile on arm64, but I put GOARCH=arm to Go during the compilation. This should work but apparently it is not. I need to troubleshoot further

On Thu, 12 Nov 2020, 09:29 2fst4u, notifications@github.com wrote:

I'm not too familiar with how Docker Hub works but I notice the "OS/arch" field for the new arm version still says "arm64". Is that a functional difference or just a metadata field?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/librespeed/speedtest-go/issues/16#issuecomment-725768851, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWXDHN63TLLJLJCKW55D3TSPM26FANCNFSM4TRH2LUQ .

2fst4u commented 3 years ago

Interesting.

Thank you for trying, I appreciate the effort. Don't feel like you have to get it done immediately for my sake, if you're anything like me then once you know something's not working it's hard to let it go until you've sorted it 😝.

No rush at all.

On Thu, 12 Nov 2020, 16:18 mickkael, notifications@github.com wrote:

I actually compile on arm64, but I put GOARCH=arm to Go during the compilation. This should work but apparently it is not. I need to troubleshoot further

On Thu, 12 Nov 2020, 09:29 2fst4u, notifications@github.com wrote:

I'm not too familiar with how Docker Hub works but I notice the "OS/arch" field for the new arm version still says "arm64". Is that a functional difference or just a metadata field?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/librespeed/speedtest-go/issues/16#issuecomment-725768851 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AEWXDHN63TLLJLJCKW55D3TSPM26FANCNFSM4TRH2LUQ

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/librespeed/speedtest-go/issues/16#issuecomment-725802942, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNCRWZDFXTQBMXM6YKITTSPNHY3ANCNFSM4TRH2LUQ .

mickkael commented 3 years ago

What about this one mickkael/librespeed-go:armv6 built from https://github.com/mickkael/speedtest-go/blob/master/Dockerfile_arm

If it works, I'll work on a multi arch image

2fst4u commented 3 years ago

No change sorry. Same error.

On Sat, 14 Nov 2020, 14:38 mickkael, notifications@github.com wrote:

What about this one mickkael/librespeed-go:armv6

If it works, I'll work on a multi arch image

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/librespeed/speedtest-go/issues/16#issuecomment-727117044, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUNCRVHO5CYDNYHPFPNF6LSPXNR5ANCNFSM4TRH2LUQ .

mickkael commented 3 years ago

kaniko is not good for cross platform, I'll install docker and build with it

mickkael commented 3 years ago

mickkael/librespeed-go:arm32v6 ?

2fst4u commented 3 years ago

Success! Nice job mate, started properly and did a full saturation of throughput on a raspberry pi 3B.

Nice work!

mickkael commented 3 years ago

Can you close the issue ? I'll build a multiarch image soon

2fst4u commented 3 years ago

Will do. Thanks for the effort.

mickkael commented 3 years ago

multiarch image available: mickkael/librespeed-go:latest arm arm64 amd64