-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for riscv64
architecture
#7151
Comments
riscv64
architecture
Recently ubuntu start to ship docker ready image for starfive vision five 2 with kernel already configured for docker and kubernetes:
It's huge change, earlier custom built kernel was needed to get at least docker/containers to work. For now boards with already updated u-boot just get ubuntu official support with quite good kernel.
|
Yeah we don't have any hardware for CI or QA so we probably won't have official support any time soon. |
RiscV is getting more and more popular and AFAIK servers with this arch are already on the way. After very successful kickstarter for star five vision five 2 board still is available on few e-shops for <$100. Of course it's still dev board and there are some issues to fix, but it's first accessible platform with some power. Also I'm sure that You need something more professional than this ;) |
- DietPi-Software | K3s: Disable for RISC-V as it is not supported yet: k3s-io/k3s#7151
Would it help if I would provide access to the 3x VisionFive V2? |
Our team already has access to dev hardware, however we don't yet have access to colocated servers that could reliably build for this platform. Until then, we are limited to cross-building, which is slow - and we're reluctant to add that to our pipeline at this time. |
Just for the record: unmatched01:~ # kubectl get node -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
unmatched01.lan.khaus Ready control-plane,etcd,master 27m v1.28.1+k3s-b44521db 10.0.1.182 <none> openSUSE Tumbleweed 6.4.12-1-default containerd://1.7.3-k3s2
unmatched02.lan.khaus Ready control-plane,etcd,master 19m v1.28.1+k3s-b44521db 10.0.1.212 <none> openSUSE Tumbleweed 6.4.12-1-default containerd://1.7.3-k3s2
unmatched03.lan.khaus Ready control-plane,etcd,master 14m v1.28.1+k3s-b44521db 10.0.1.188 <none> openSUSE Tumbleweed 6.4.12-1-default containerd://1.7.3-k3s2 |
Note that there are no images available to run on these nodes yet, as our rancher-mirrored images exclude the riscv platform. |
Thanks for update! |
You can follow rancher/image-mirror#502 |
Hello, I'm here to just mention, I have a RISC-V 64 (StarFive 2) machine as well, and would like to add it my existing k3s cluster. Thank you for the work, all the best. |
For those interested; I have K3S running on 4 StarFive Vision 2s using https://github.com/CARV-ICS-FORTH/kubernetes-riscv64. I have been able to port some more containers like the demo programs I use in my K8S classes as well as NFS-STORAGE-PROVISIONER. I am currently studying porting OpenEBS and Longhorn. It looks like the RISCV64 for K3S porting project is stalled a little bit, so I am trying to fork my own tree for experiments. |
We're kind of just waiting for the ecosystem to catch up. Once upstreams for all our various helper projects, images, and build tools support riscv64 this will be easier to move forward. |
In alpinelinux, we have packaged |
Oh, that's fun. |
Which ones, exactly? I have a stable VisionFive2 as well and did a blind attempt at building, only to be greeted by Dapper not knowing what to do. What are the core components? I tried tracing the Makefile and scripts to find out precisely which components are needed to build k3s. Do you happen to have something like a "dependency list" in this regard? With it, I could try and see which of them do build on riscv64 and work, and later attempt to help upstream potential fixes. As for Go itself, you should be able to install Would love to help! |
So I gave this another spin and took a look at all the things that are required during build. And the biggest one is: Dapper needs containers - to be specific, Is there a way to build without Dapper? From what I could gather, all it really does is set up a Go environment in the container and then run arbitrary commands there - and it also seems to use Trivy, but I haven't yet figured out how or where. Dapper built just fine with For porting purposes, it'd be nice to have a build script, or instructions, on how to build without needing to rely on Dapper. In the meantime, I will keep trying. :) BTW, I set the repo to |
Quoting Ingwie Phoenix ***@***.***>:
Good day Ingwie,
Kindly check https://github.com/CARV-ICS-FORTH/k3s/releases
It is (was) a sponsored project. I am working with it for 3 months
now, getting it working on Starfive Vision5-2 SOC. 'till January 31th
it wasn't working on RISCV64 Licheepi4a due to a kernel misconfig. I
can confirm it's working again. This project most probably was used as
more of a Proof Of Concept. They support 1.27.3 of K8S/K3S and no new
releases have been created after this.
If you'd like we can work together to make it work for K8S 1.29.x and
higher. Any help/support/advise from Rancher/SUSE/K3S would be helpful.
If you have further questions, kindly let me know.
Kind regards,
Pascal van Dam
… So I gave this another spin and took a look at all the things that
are required during build.
And the biggest one is: Dapper needs containers - to be specific,
`Dockerfile.dapper` specifies `golang:1.21.6-alpine3.18`.
Whilst there are a few riscv64 images (busybox, some alpine images,
debian, ubuntu), those very specific tags do not exist.
Is there a way to build _without_ Dapper? From what I could gather,
all it really does is set up a Go environment in the container and
then run arbitrary commands there - and it also seems to use Trivy,
but I haven't yet figured out how or where.
Dapper built just fine with `go install
***@***.***`, by the way. Haven't tried trivy
yet.
For porting purposes, it'd be nice to have a build script, or
instructions, on how to build without needing to rely on Dapper.
In the meantime, I will keep trying. :) BTW, I set the repo to
`v1.29.1+k3s2`. Long term I want to match k3s versions across my
cluster - and then there is also the problem of building
non-existing images and tagging them in a way that k3s will find
them...
--
Reply to this email directly or view it on GitHub:
#7151 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
Hello @pascal71 ! As it turns out, Here are a few changes I did in order to try and make it work:
But in the end, ignoring
This was actually fixed a while later. But I am quite new to Go development... so, I am still looking at how to efficiently update that specific module. After that, the build should pass. mkdir -p build/data
# Make sure to edit the k3s-root version reference.
./scripts/download
./scripts/generate
# This is where I am stuck.
./scripts/build It's quite close and the fixes required are minimal. That said, I am still on an older branch ( Do you happen to know how I can edit that specific dependency? Thanks, and kind regards, |
I think I said this earlier, but it is not hard to build k3s for riscv64. The issue is that none of our images currently support riscv64. Up until recently alpine didn't support it either, except in edge. Once we actually have something to run on this architecture we will reevaluate making binaries available. |
So do I understand you correctly that all you need is a set of Alpine images compiled for RISC-V? |
I am down to two problems: Setting rootfs in There is apparently a fix for that here in this PR: marten-seemann/tcp#1 (comment)
This results in this: diff --git a/go.mod b/go.mod
index c8f1d243ff..167f318209 100644
--- a/go.mod
+++ b/go.mod
@@ -2,6 +2,8 @@ module github.com/k3s-io/k3s
go 1.21
+replace github.com/marten-seemann/tcp => github.com/r-value/tcp v0.0.0-20211124094235-5d06fda83888
+
replace (
github.com/Microsoft/hcsshim => github.com/Microsoft/hcsshim v0.11.0
github.com/Mirantis/cri-dockerd => github.com/k3s-io/cri-dockerd v0.3.9-k3s2 // k3s/release-1.28
diff --git a/go.sum b/go.sum
index 858cd6e414..88d4a49714 100644
--- a/go.sum
+++ b/go.sum
@@ -1140,8 +1140,6 @@ github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
-github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk=
-github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
@@ -1475,6 +1473,8 @@ github.com/quic-go/quic-go v0.38.2 h1:VWv/6gxIoB8hROQJhx1JEyiegsUQ+zMN3em3kynTGd
github.com/quic-go/quic-go v0.38.2/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4=
github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU=
github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU=
+github.com/r-value/tcp v0.0.0-20211124094235-5d06fda83888 h1:skZUklgonyd2bz0llv7AjdCuaTeZ1JP5hSqQi5m9aE4=
+github.com/r-value/tcp v0.0.0-20211124094235-5d06fda83888/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU=
github.com/rancher/dynamiclistener v0.3.6 h1:iAFWeiFNra6tYlt4k+jINrK3hOxZ8mjW2S/9nA6sxKs=
github.com/rancher/dynamiclistener v0.3.6/go.mod h1:VqBaJNi+bZmre0+gi+2Jb6jbn7ovHzRueW+M7QhVKsk=
github.com/rancher/lasso v0.0.0-20230830164424-d684fdeb6f29 h1:+kige/h8/LnzWgPjB5NUIHz/pWiW/lFpqcTUkN5uulY=
diff --git a/scripts/version.sh b/scripts/version.sh
index a67f0d5607..939465c0f2 100755
--- a/scripts/version.sh
+++ b/scripts/version.sh
@@ -75,7 +75,7 @@ if [ -z "$VERSION_KUBE_ROUTER" ]; then
VERSION_KUBE_ROUTER="v0.0.0"
fi
-VERSION_ROOT="v0.12.2"
+VERSION_ROOT="v0.13.0"
DEPENDENCIES_URL="https://raw.githubusercontent.com/kubernetes/kubernetes/${VERSION_K8S}/build/dependencies.yaml"
VERSION_GOLANG="go"$(curl -sL "${DEPENDENCIES_URL}" | yq e '.dependencies[] | select(.name == "golang: upstream version").version' -) Still building since a good 30min. This'll take a while, as I am doing this on the target. But from what all I could tell, this is literally all that is needed. By the way, neither of those Is using |
|
@IngwiePhoenix do you happen to have a final set of instructions to build this locally, and have it run? Thank you for doing all the recon work, and making it work. |
@plsnotracking Sure - it's actually really simple ... once you spent hours figuring it out, learning some Go in the meantime and getting to know a bunch of k3s repos. x)
You now have a fully built k3s! The patch itself is super small, and you just have to ignore the fancy containerized build start to finish - but other than that, this works. It took me way too long to figure this out... Give it a try! The build doesn't actually take this long - building Vaultwarden took much longer. Also, my final repo size is:
About half of a built Linux kernel tree - so you should easily be able to build this on an eMMC or something. Throw it into a |
Thank you. Although tangential, I had a small problem running into cloning the repo ❯ git clone -b "v1.29.2+k3s1" https://github.com/k3s-io/k3s.git
Cloning into 'k3s'...
remote: Enumerating objects: 994636, done.
remote: Counting objects: 100% (1896/1896), done.
remote: Compressing objects: 100% (897/897), done.
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
error: 7160 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output I will try to increase the buffer size or fallback to |
Try the SSH method ( |
Hi, if someone is looking for some riscv64 images, look in my repository on docker hub: allardkrings/riscv64…. |
I have no idea what, how, or when, but using just the shell scripts and ignoring Dapper, k3s builds perfectly fine now! root@riscboi /n/o/k3s ((v1.30.4+k3s1))# ./scripts/download; and ./scripts/build; and ./scripts/package-cli
# ... build ...
root@riscboi /n/o/k3s ((v1.30.4+k3s1))# dist/artifacts/k3s-riscv64 --version
k3s-riscv64 version v1.30.4+k3s1 (98262b5d)
go version go1.22.6 Doesn't even have the Guess the next folks I have to bother is the Dapper devs. =) But this is already pretty amazing. I will try to create an exemplary cluster in my spare time on the weekend to see if it works and how far that goes - but it is getting there! |
I was able to build it and run without any modifications as well: matheus@bananapif3:~/projects/k3s-1.31.0-k3s1/dist/artifacts$ file k3s-riscv64
k3s-riscv64: ELF 64-bit LSB executable, UCB RISC-V, double-float ABI, version 1 (SYSV), statically linked, Go BuildID=CNTMeyK6zfqNoG_8tf9Y/VeWQpkv5wHO-CF7fbVKk/AS2IhtUPexyrtYdAcPZw/w9_GGPikbHqd-UOkmAKk, stripped
matheus@bananapif3:~/projects/k3s-1.31.0-k3s1/dist/artifacts$ ldd k3s-riscv64
not a dynamic executable
matheus@bananapif3:~/projects/k3s-1.31.0-k3s1/dist/artifacts$ ./k3s-riscv64 --version
k3s-riscv64 version v1.31.0+k3s- ()
go version go1.22.5 But as you've pointed out there are some images that are not available for riscv64, and I got this error: E0916 13:01:04.771972 44618 log.go:32] "RunPodSandbox from runtime service failed" err="rpc error: code = NotFound desc = failed to get sandbox image \"rancher/mirrored-pause:3.6\": failed to pull image \"rancher/mirrored-pause:3.6\": failed to pull and unpack image \"docker.io/rancher/mirrored-pause:3.6\": no match for platform in manifest: not found" I've found that the pause image is being mirrored from Kubernetes directly |
I do believe there is a way to configure those images to be sourced from alternative paths? Did you build with the scripts or with Dapper? |
Just with the scripts, thanks for the instructions! I am able to build the pause image myself, but for the upstreaming efforts it looks a bit more complicated 😬 There's some requirement on |
Yep, that's correct. However: The definition
So, technically it's possible. That said, I don't know where/when this is built or not. Oh well, I've been waiting this long, I can wait a little longer too! But seriously there should be a configuration for that. I very much remember having that recommended in either another issue related to riscv support or in a linked repository...darn, I can't remember it. :/ also you're welcome! |
I think the main hurdle is needing to build a custom image of |
edited by @brandond
Repurposing this as a tracking issue for riscv64 support.
This has not been prioritized, and we don't have any build infra for riscv64, so at the moment this will be purely experimental.
The text was updated successfully, but these errors were encountered: