Bare Metal Kubernetes Quick Installation Arm64 & Arch

- kubernetes linux arch

I’m still playing with my 3 nodes arm64 cluster, having some stability issues with k3s, I turned into kubeadm to deploy a bare metal non HA one master two workers Kubernetes cluster.

My host is Arch which is theoretically not supported but still works.

Required tasks

sudo pacman -S ethtool ebtables socat cni-plugins

Install aur/kubelet-bin and aur/kubeadm-bin

I needed a private registry to host my images, on master node:

docker run -d -p 5000:5000 --restart=always -v /opt/local-path-provisioner/registry:/var/lib/registry  --name registry registry:2

On all hosts:

cat > /etc/sysctl.d/bridge.conf <<EOF                             

cat > /etc/docker/daemon.json <<EOF
  "insecure-registries" : ["mymasternode:5000"],
  "exec-opts": ["native.cgroupdriver=systemd"]

sudo systemctl restart docker


Start kubeadm on the master

sudo kubeadm init --pod-network-cidr --apiserver-advertise-address --apiserver-cert-extra-sans extrahostname.node  --node-name mymasternode

To make kubectl talk to the new cluster:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Change kubeadm config to point it to /usr/lib/cni which is the path used by the Arch package edit /var/lib/kubelet/kubeadm-flags.env:

KUBELET_KUBEADM_ARGS="--cgroup-driver=systemd --hostname-override=mymasternode --network-plugin=cni --resolv-conf=/run/systemd/resolve/resolv.conf --cni-bin-dir=/usr/lib/cni"
sudo systemctl restart kubelet

On worker nodes:

kubeadm join --token q3l12s.r811b5pbibi9mjy \
    --discovery-token-ca-cert-hash sha256:b67aaaaaaaaaaaaaaaaabbbbbbbccccccc --node-name myworker1

Modify /var/lib/kubelet/kubeadm-flags.env to add --cni-bin-dir=/usr/lib/cni on the workers then restart kubelet.

Install Flannel

On this very small cluster with a dedicated layer 2 connection there is no need for vxlan (which I had issues troubleshooting with k3s), so I’ve applied the multi arch Flannel deployment with a twist.

curl |  sed "s/vxlan/host-gw/" > kube-flannel.yaml

Label your nodes as wanted:

kubectl label node myworker2

Delete everything

If something goes wrong you can restart from scratch with.

kubectl drain <node name> --delete-local-data --force --ignore-daemonsets
kubeadm reset
docker system prune -a
iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X