Tech Blog

riscv64 な k3s を試してみる

Cover Image for riscv64 な k3s を試してみる

K3s の riscv64 対応が進んでるので試してみた

今回の環境

TL;DR

1. K3s のインストール

curl -fsSLO https://github.com/CARV-ICS-FORTH/k3s/releases/download/20230721/k3s-riscv64.gz.aa
curl -fsSLO https://github.com/CARV-ICS-FORTH/k3s/releases/download/20230721/k3s-riscv64.gz.ab
curl -fsSLO https://github.com/CARV-ICS-FORTH/k3s/releases/download/20230721/k3s-riscv64.gz.ac
cat k3s-riscv64.gz.* | gunzip > /usr/local/bin/k3s
sudo chmod +x /usr/local/bin/k3s
curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_DOWNLOAD=true sh -
[INFO]  Skipping k3s download and verify
[INFO]  Skipping installation of SELinux RPM
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Creating /usr/local/bin/ctr symlink to k3s
[INFO]  Creating killall script /usr/local/bin/k3s-killall.sh
[INFO]  Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO]  systemd: Starting k3s
curl http://localhost/version
{
  "major": "1",
  "minor": "27",
  "gitVersion": "v1.27.3+k3s-9d376dfb-dirty",
  "gitCommit": "9d376dfbd609178b16ea5f9b7700894bb7c1f527",
  "gitTreeState": "dirty",
  "buildDate": "2023-07-21T05:01:31Z",
  "goVersion": "go1.20.5",
  "compiler": "gc",
  "platform": "linux/riscv64"
}
sudo k3s kubectl get node
NAME     STATUS   ROLES                  AGE    VERSION
ubuntu   Ready    control-plane,master   15s    v1.27.3+k3s-9d376dfb-dirty

2.helm のインストール

curl -fsSL https://get.helm.sh/helm-v3.14.0-linux-riscv64.tar.gz | tar zxvf -
linux-riscv64/
linux-riscv64/LICENSE
linux-riscv64/helm
linux-riscv64/README.md
sudo mv -fv linux-riscv64 /usr/local/src/helm
renamed 'linux-riscv64/helm' -> '/usr/local/bin/helm'
helm version
version.BuildInfo{Version:"v3.14.0", GitCommit:"3fc9f4b2638e76f26739cd77c7017139be81d0ea", GitTreeState:"clean", GoVersion:"go1.21.5"}

3.hello-kubernetes

kubectl apply -f https://raw.githubusercontent.com/CARV-ICS-FORTH/kubernetes-riscv64/main/examples/hello-kubernetes.yaml
service/hello created
deployment.apps/hello created
export POD_NAME=$(kubectl get pods -n default -l "app=hello" -o jsonpath="{.items[0].metadata.name}")
echo https://127.0.0.1:8080/
https://127.0.0.1:8080/
kubectl -n default port-forward $POD_NAME 8080:8080

Forwarding from 0.0.0.0:8080 -> 8080
Forwarding from [::]:8080 -> 8080

4.確認する

Hello Kubernetes!

参考にしたページ