Repository: canonical/microk8s

Issue:
Microk8s on armhf architecture
Hi all, 

The armhf binary is missing and not available right now, which means that some users cannot install microk8s on Ubuntu. For example, if you use the armhf image for Raspberry Pi, you cannot install microk8s: 

> ubuntu@battlecruiser:~$ sudo snap install microk8s --classic
> error: snap "microk8s" is not available on stable for this architecture (armhf)
>        but exists on other architectures (amd64, arm64, ppc64el).

It would be really good if we could also get the build compiled for this architecture and make officially available. 

Cheers,

- Calvin 


Discussion:
this is a duplicate issue of https://github.com/ubuntu/microk8s/issues/228


@recklessop you're correct yes, my apologies. I have hardware available we could use to address the problem. 
Does the detail at:

https://microk8s.io/docs/install-alternatives#arm

"... This can be remedied on the Rasberry Pi by editing the boot parameters: ..."

imply that  this is now solved?
> imply that this is now solved?

No the issue is not resolved. The instructions are for arm64 not for armhf. We currently do not build for this architecture. You can try to create a build yourself by git cloneing the repo and running  `snapcraft` possibly in a remote build as described here https://forum.snapcraft.io/t/preview-snapcraft-remote-build/11541 Note that we have not tested this so any patches you can provide are welcomed.
Running into this now myself. 
running into this is as well.

I've tried using `snapcraft remote-build` as well. I get this error:

> Remote-build does not support the use of `version-script`.
> Please use `snapcraftctl set-version` part scriptlet with `adopt-info`, or set `version` statically.
Also running into this, dietpi on RPI4 all recent builds as of this date
@erasmus74 I am fairly certain RPi4 is on ARM64. Could you double check the OS you have installed?
You're correct, I was on armhf/32-bit, switching to 64bit worked like a charm
Same issue on Raspberry PI 3 B.
I ended up using [k3s](https://k3s.io/).
I also run in the same issue with some Odroids XU4 where I had previously used upstream k8s. I just did a PoC build directly in the device and it did work after I commented out the etcd snap part ot built. The issue with etcd is that they do not build for arm so it would need to be built from sources - doable but since etcd is not really needed not key for a PoC.

Now trying to run I see two issues:
- scripts/wrappers/common/utils.py is missing a mapping for the `armv7l` arch so kubectl status fails. I will add and rebuild
- the k8s api service is not running - missing libuv1 -> `/snap/microk8s/x1/kube-apiserver: error while loading shared libraries: libuv.so.1: cannot open shared object file: No such file`

Output from microk8s inspect:
```
root@n5:~/microk8s# microk8s inspect
Inspecting Certificates
Inspecting services
  Service snap.microk8s.daemon-cluster-agent is running
  Service snap.microk8s.daemon-containerd is running
 FAIL:  Service snap.microk8s.daemon-apiserver is not running
For more details look at: sudo journalctl -u snap.microk8s.daemon-apiserver
  Service snap.microk8s.daemon-apiserver-kicker is running
  Service snap.microk8s.daemon-control-plane-kicker is running
  Service snap.microk8s.daemon-proxy is running
  Service snap.microk8s.daemon-kubelet is running
  Service snap.microk8s.daemon-scheduler is running
  Service snap.microk8s.daemon-controller-manager is running
  Copy service arguments to the final report tarball
Inspecting AppArmor configuration
```
Will continue tomorrow.

@ktsakalozos - in case it makes sense to add to your pipeline and submit a PR - do you build on remote or do you have native arm HW?


Resolving patch:
diff --git a/scripts/wrappers/common/utils.py b/scripts/wrappers/common/utils.py
--- a/scripts/wrappers/common/utils.py
+++ b/scripts/wrappers/common/utils.py
@@ -15,7 +15,7 @@
 
 def get_current_arch():
     # architecture mapping
-    arch_mapping = {"aarch64": "arm64", "x86_64": "amd64"}
+    arch_mapping = {"aarch64": "arm64", "armv7l": "armhf", "x86_64": "amd64"}
 
     return arch_mapping[platform.machine()]
 


Test patch: