Installing a microk8s cluster
This content provides a summary of how to install MicroK8s, a lightweight and small Kubernetes cluster, on Ubuntu 22.04.4 LTS. (For more information, see the MicroK8s documentation.)
Note: This type of edge cluster is meant for development and test because a single worker node Kubernetes cluster does not provide scalability or high availability.
Procedure
Install MicroK8s:
sudo snap install microk8s --classic --channel=stableIf you are not running as root, add your user to the MicroK8s group:
sudo usermod -a -G microk8s $USER sudo chown -f -R $USER ~/.kube su - $USEREnable dns and storage modules in MicroK8s:
microk8s.enable dns microk8s.enable hostpath-storageNote: MicroK8s uses 8.8.8.8 and 8.8.4.4 as upstream name servers by default. If these name servers cannot resolve the management hub hostname, you must change the name servers that MicroK8s is using:
a. Retrieve the list of upstream name servers in
/etc/resolv.confor/run/system/resolve/resolv.confb. Edit coredns configmap in the kube-system namespace. Set the upstream nameservers in the forward section:
microk8s.kubectl edit -n kube-system cm/corednsCheck the status:
microk8s.status --wait-readyThe MicroK8s kubectl command is called microk8s.kubectl to prevent conflicts with an already install kubectl command. Assuming that kubectl is not installed, add this alias for microk8s.kubectl:
echo 'alias kubectl=microk8s.kubectl' >> ~/.bash_aliases source ~/.bash_aliasesChoose the image registry types: remote image registry or edge cluster local registry. Image registry is the place that will hold the agent image and agent cronjob image.