kubernetes-retired/etcdadm

Factor in cpu arch

Closed this issue ยท 3 comments

The build was successful, however, running init shows it trying to use the amd64 bundle on arm

etcdadm init
INFO[0000] [install] Artifact not found in cache. Trying to fetch from upstream: https://github.com/coreos/etcd/releases/download
INFO[0000] [install] Downloading & installing etcd https://github.com/coreos/etcd/releases/download from 3.4.13 to /var/cache/etcdadm/etcd/v3.4.13
INFO[0000] [install] downloading etcd from https://github.com/coreos/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz to /var/cache/etcdadm/etcd/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
######################################################################## 100.0%##=O#- #
INFO[0001] [install] extracting etcd archive /var/cache/etcdadm/etcd/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz to /tmp/etcd638248988
INFO[0002] [install] verifying etcd 3.4.13 is installed in /opt/bin/
FATA[0002] [install] Error: fork/exec /opt/bin/etcd: exec format error

@sfxworks I add code make etcdadm support linux other arch, you can merge code to your local and build it to try, because i have no arm host. If it have problem, welcome to point out it.

From commit 8ec785e

root@rockpro4gb:~# etcdadm version
version.Info{Major:"0", Minor:"1+", GitVersion:"v0.1.1-555+8ec785ecdb095c-dirty", GitCommit:"8ec785ecdb095cc74e2aabc53d231ef5e65da17b", GitTreeState:"dirty", BuildDate:"2021-06-20T06:19:08Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/arm64"}

root@rockpro4gb:~# etcdadm init
INFO[0000] [install] Artifact not found in cache. Trying to fetch from upstream: https://github.com/coreos/etcd/releases/download
INFO[0000] [install] Downloading & installing etcd https://github.com/coreos/etcd/releases/download from 3.4.13 to /var/cache/etcdadm/etcd/v3.4.13
INFO[0000] [install] downloading etcd from https://github.com/coreos/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-arm64.tar.gz to /var/cache/etcdadm/etcd/v3.4.13/etcd-v3.4.13-linux-arm64.tar.gz
######################################################################## 100.0%##O#- #
INFO[0001] [install] extracting etcd archive /var/cache/etcdadm/etcd/v3.4.13/etcd-v3.4.13-linux-arm64.tar.gz to /tmp/etcd098382588
INFO[0002] [install] verifying etcd 3.4.13 is installed in /opt/bin/
FATA[0002] [install] Error: command "/opt/bin/etcd" failed: ""

Tried clearing any cache using from a possible old run

root@rockpro4gb:~# rm /opt/bin/etcd
root@rockpro4gb:~# rm /opt/bin/etcdctl
root@rockpro4gb:~# rm -rf /var/cache/etcdadm/
root@rockpro4gb:~# rm -rf /tmp/etcd098382588
INFO[0000] [reset] etcd service is not running
INFO[0000] [membership] Assuming that the member was removed
INFO[0000] remove /etc/systemd/system/etcd.service: no such file or directory
INFO[0000] remove /etc/etcd/etcd.env: no such file or directory
INFO[0000] remove /etc/etcd/etcdctl.env: no such file or directory
INFO[0000] remove /opt/bin/etcdctl.sh: no such file or directory
INFO[0000] [cluster] etcd reset complete

Got same result

Looks like I get this when I try to run it

root@rockpro4gb:~# /opt/bin/etcd --version
etcd on unsupported platform without ETCD_UNSUPPORTED_ARCH=arm64 set

So I exported it

root@rockpro4gb:~# export ETCD_UNSUPPORTED_ARCH=arm64
root@rockpro4gb:~# etcdadm init
INFO[0000] [install] extracting etcd archive /var/cache/etcdadm/etcd/v3.4.13/etcd-v3.4.13-linux-arm64.tar.gz to /tmp/etcd182067078
INFO[0001] [install] verifying etcd 3.4.13 is installed in /opt/bin/
INFO[0001] [certificates] creating PKI assets
INFO[0001] creating a self signed etcd CA certificate and key files
[certificates] Generated ca certificate and key.
INFO[0002] creating a new server certificate and key files for etcd
[certificates] Generated server certificate and key.
[certificates] server serving cert is signed for DNS names [rockpro4gb] and IPs [192.168.0.105 127.0.0.1]
INFO[0002] creating a new certificate and key files for etcd peering
[certificates] Generated peer certificate and key.
[certificates] peer serving cert is signed for DNS names [rockpro4gb] and IPs [192.168.0.105]
INFO[0004] creating a new client certificate for the etcdctl
[certificates] Generated etcdctl-etcd-client certificate and key.
INFO[0004] creating a new client certificate for the apiserver calling etcd
[certificates] Generated apiserver-etcd-client certificate and key.
[certificates] valid certificates and keys now exist in "/etc/etcd/pki"
FATA[0006] [start] Error: failed to start service: exit status 1

So I added it to your /etc/etcd/etcd.env

And it's up

root@rockpro4gb:~# systemctl status  etcd
โ— etcd.service - etcd
     Loaded: loaded (/etc/systemd/system/etcd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2021-06-20 06:30:11 UTC; 6s ago
       Docs: https://github.com/coreos/etcd
   Main PID: 10008 (etcd)
      Tasks: 18 (limit: 4459)
     Memory: 5.8M (low: 200.0M)
     CGroup: /system.slice/etcd.service
             โ””โ”€10008 /opt/bin/etcd

Jun 20 06:30:11 rockpro4gb etcd[10008]: raft2021/06/20 06:30:11 INFO: raft.node: 5116c5741ac4ea6f elected leader 5116c5741ac4ea6f at term 2
Jun 20 06:30:11 rockpro4gb etcd[10008]: setting up the initial cluster version to 3.4
Jun 20 06:30:11 rockpro4gb etcd[10008]: set the initial cluster version to 3.4
Jun 20 06:30:11 rockpro4gb etcd[10008]: ready to serve client requests
Jun 20 06:30:11 rockpro4gb etcd[10008]: ready to serve client requests
Jun 20 06:30:11 rockpro4gb etcd[10008]: published {Name:rockpro4gb ClientURLs:[https://192.168.0.105:2379]} to cluster 2c758ff76e0b6b0d
Jun 20 06:30:11 rockpro4gb etcd[10008]: enabled capabilities for version 3.4
Jun 20 06:30:11 rockpro4gb systemd[1]: Started etcd.
Jun 20 06:30:11 rockpro4gb etcd[10008]: serving client requests on 127.0.0.1:2379
Jun 20 06:30:11 rockpro4gb etcd[10008]: serving client requests on 192.168.0.105:2379