Basic Kubernetes install with microk8s and NFS storage
microk8s is an open-source lightweight low-ops system using core Kubernetes components. .
In this article we will be looking at adjusting the microk8s install to use NFS storage. This storage type is better suited to production environments. It can be shared across multiple nodes (or single nodes) and is easily scalable. It is also native to Linux which helps with stability.
NFS is found in the Microk8s community Repository, let's take a look at how we get that setup.
Log into your VM terminal and run:
This will install microk8s. once this is completed you can run:
This will give your user access to microk8s and assign the ~/.kube directory to your user You may need to logout and log back into your VM for these to take effect.
you can also enable some metric scraping tools for monitoring
and lastly you will need to enable metallb for loadbalancer capabilities. To make things simple, get the external IP of your VM, the run:
you will be prompted for an IP range, you can input your vm IP as a range. EG: 192.168.15.42-192.168.15.42
This will make sure the utopia ingress loadbalancer is given this IP.
Before you install Utopia, it is recommended to add your kube config details to your local kube config to allow ease of access from your local machine.
To view your new config you can run:
you can then take these details and add them to your local config file. This file is usually found in ~/.kube
Now we can take a look at getting the storage setup for NFS.
Great! now the community is enabled we can now install NFS. you can see more details here.
Each node needs to have NFS enabled, you can run this command on each node
now nfs has been installed on each node, you can now enable the storage class using microk8s
Awesome! now storage-class nfs has been installed and enabled. don't forget to use nfs as the storage class type for your utopia install.
Last updated