kubernetes-up-and-running / kuard

Demo app for Kubernetes Up and Running book
Apache License 2.0
1.56k stars 536 forks source link

Provide ARM build #5

Closed tomas-mazak closed 6 years ago

tomas-mazak commented 6 years ago

Hello, I am following the book with (kind-of) RPi cluster. However, this demo seems not to be available for arm:

tomas@arkham:~$ docker pull gcr.io/kuar-demo/kuard-amd64:1
1: Pulling from kuar-demo/kuard-amd64
ec37562cf8fa: Pull complete 
f50fc4297ee3: Pull complete 
Digest: sha256:a5805d4728b3017ee910e914a129e1901e68d7c9867743ff1f345eb8a1b5c41f
Status: Downloaded newer image for gcr.io/kuar-demo/kuard-amd64:1
tomas@arkham:~$ docker pull gcr.io/kuar-demo/kuard-arm:1
Error response from daemon: manifest for gcr.io/kuar-demo/kuard-arm:1 not found

Could you perhaps build this for arm as well and add it to the registry?

Thanks a lot, Tomas

ecliptik commented 6 years ago

Does gcr.io support multi-platform like Docker Hub (https://integratedcode.us/2017/09/13/dockerhub-official-images-go-multi-platform/)?

If so, it would be nice to just have a gcr.io/kuar-demo/kuard:1 image that supports amd64, arm64, armhf, power, s390x, etc so the commands in the book are portable between architectures (or at least future editions).

kable-wilmoth commented 6 years ago

Looking forward to an arm64 version as well. Especially since the Appendix of the book encouraged me to build out a raspberry pi cluster ;>) Would like to run this on it now.

dprangnell commented 6 years ago

Yes, I also just read the book, and followed the guide in the appendix to build the Raspberry Pi cluster. I assumed the demo would be available for arm, now I see it isn't. A bit frustrating after spending about $300 on a raspberry pi cluster.


Update: I compiled it for arm and made it available on dockerhub. You can test it easily as follows from your pi:

kubectl run kuard-arm1 --image=davidpr90019/kuard-arm:1
jbeda commented 6 years ago

I just created some arm, arm64 and ppc64le cross builds. I don't have easy ways to test these. If someone can confirm that the arm{64} one works, I'll put that on the readme.

Thanks!

jbeda commented 6 years ago

Specifically, the following images now exist:

gcr.io/kuar-demo/kuard-arm:v0.7-1
gcr.io/kuar-demo/kuard-arm:1
gcr.io/kuar-demo/kuard-arm:v0.7-2
gcr.io/kuar-demo/kuard-arm:2
gcr.io/kuar-demo/kuard-arm:v0.7-3
gcr.io/kuar-demo/kuard-arm:3
gcr.io/kuar-demo/kuard-arm64:v0.7-1
gcr.io/kuar-demo/kuard-arm64:1
gcr.io/kuar-demo/kuard-arm64:v0.7-2
gcr.io/kuar-demo/kuard-arm64:2
gcr.io/kuar-demo/kuard-arm64:v0.7-3
gcr.io/kuar-demo/kuard-arm64:3
gcr.io/kuar-demo/kuard-ppc64le:v0.7-1
gcr.io/kuar-demo/kuard-ppc64le:1
gcr.io/kuar-demo/kuard-ppc64le:v0.7-2
gcr.io/kuar-demo/kuard-ppc64le:2
gcr.io/kuar-demo/kuard-ppc64le:v0.7-3
gcr.io/kuar-demo/kuard-ppc64le:3
gcr.io/kuar-demo/kuard-amd64:v0.7-1
gcr.io/kuar-demo/kuard-amd64:1
gcr.io/kuar-demo/kuard-amd64:v0.7-2
gcr.io/kuar-demo/kuard-amd64:2
gcr.io/kuar-demo/kuard-amd64:v0.7-3
gcr.io/kuar-demo/kuard-amd64:3
ecliptik commented 6 years ago

Thank you @jbeda . I just tried this out quickly on an RPI3 with HypriotOS (based off Debian 9) and the container for arm and arm64 gives the following error,

HypriotOS/arm64: pirate@tatl in ~
$ docker run -it --rm gcr.io/kuar-demo/kuard-arm64:3
docker: Error response from daemon: linux spec user: unable to find group nobody: no matching entries in group file.

It does work properly if --user nobody is passed

$ docker run -it --rm --user nobody gcr.io/kuar-demo/kuard-arm64:3
2018/01/02 19:59:07 Starting kuard version: v0.7-3
2018/01/02 19:59:07 **********************************************************************
...
2018/01/02 19:59:07 Could not find certificates to serve TLS
2018/01/02 19:59:07 Serving on HTTP on :8080

To test I ran docker run -it --rm gcr.io/kuar-demo/kuard-amd64:3 on a Debian 9 amd64 system without --user nobody and it works. Not sure why there's a discrepancy between the two.

I'm going to go through the examples in the book tonight using these containers on a arm64 k8s RPI3 cluster and may need to tweak a few things to use nobody.

jbeda commented 6 years ago

I switched the base image to alpine for the non-amd64 builds and built/pushed the arm64 version. Please re-pull and give it a try and let me know if it works. I'm hoping this also takes care of the TLS cert issues. If that works I'll tag it as 0.7.1 and re-push.

ecliptik commented 6 years ago

@jbeda looks like it's working to me,

HypriotOS/arm64: pirate@tael in ~
$ docker run -it --rm -p 8080:8080 gcr.io/kuar-demo/kuard-arm64:3
2018/01/04 07:33:28 Starting kuard version: v0.7-1-g5391b9f-3
...
2018/01/04 07:33:28 Could not find certificates to serve TLS
2018/01/04 07:33:28 Serving on HTTP on :8080
2018/01/04 07:33:30 192.168.7.31:62222 GET /
2018/01/04 07:33:30 Loading template for index.html
2018/01/04 07:33:30 192.168.7.31:62222 GET /static/css/bootstrap.min.css
2018/01/04 07:33:30 192.168.7.31:62223 GET /static/css/styles.css
2018/01/04 07:33:30 192.168.7.31:62224 GET /built/bundle.js
2018/01/04 07:33:30 192.168.7.31:62226 GET /favicon.ico

Tried out one of the first examples in the book on an RPI cluster as well and it works with only changing the image to arm64,

🐳  kubectl describe node tatl | grep -i architecture
 Architecture:               arm64

🐳  kubectl run kuard --image=gcr.io/kuar-demo/kuard-arm64:1
deployment "kuard" created

🐳  kubectl get pods -o wide
NAME                     READY     STATUS    RESTARTS   AGE       IP           NODE
kuard-77cfb45df5-thfkh   1/1       Running   0          6m        10.244.2.2   tatl

🐳  kubectl get pods kuard-77cfb45df5-thfkh -o jsonpath --template='{.spec.containers[0].image}'
gcr.io/kuar-demo/kuard-arm64:1
jbeda commented 6 years ago

@ecliptik Sweet! I'll make it official with d71c7f1 and v0.7.1.