Both nodes have Role=<none> ; How to assign master role to a node

Hi *.
I’ve setup a two node cluster with microk8s and it works. I ran in an issue with an error message like

1 node(s) didn't match Pod's node affinity/selector.

After some troubleshooting I found out that none of my nodes seem to have the master role

kubectl get nodes -o wide
NAME                STATUS   ROLES    AGE   VERSION                    INTERNAL-IP     EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION     CONTAINER-RUNTIME
ubuntu-k8-sradtke   Ready   <none>   14d   v1.23.3-2+d441060727c463   10.220.151.51   <none>        Ubuntu 20.04.3 LTS   5.4.0-99-generic   containerd://1.5.7
k8worker1           Ready    <none>   11d   v1.23.3-2+d441060727c463   10.220.150.90   <none>        Ubuntu 20.04.3 LTS   5.4.0-97-generic   containerd://1.5.7

Also “kubectl descibe node” shows the role of the supposed master node as role=none:

kubectl describe node ubuntu-k8-sradtke 
Name:               ubuntu-k8-sradtke
**Roles:              <none>**
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=ubuntu-k8-sradtke
                    kubernetes.io/os=linux
                    microk8s.io/cluster=true
                    node.kubernetes.io/microk8s-controlplane=microk8s-controlplane
Annotations:        node.alpha.kubernetes.io/ttl: 0
                    projectcalico.org/IPv4Address: 10.220.151.51/16
                    projectcalico.org/IPv4VXLANTunnelAddr: 10.1.86.64
                    volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp:  Sun, 30 Jan 2022 13:41:26 +0000
Taints:             <none>

I think it worked in the beginning (not sure though) but I rebooted the master node once.
Any idea how I can assign the master role to the relevant node in a microk8s cluster?

I have the same problem, running microk8s with only one node (local cluster) it has role

Roles are just labels on nodes. To add for example the wole worker on the node “mynode” do:

microk8s kubectl label node mynode node-role.kubernetes.io/worker=worker

See kubeadm - How to add roles to nodes in Kubernetes? - Stack Overflow