2024-08-11 09:01:10 +02:00
2024-08-10 19:36:13 +02:00
2024-08-09 09:53:43 +02:00
2024-08-09 23:51:07 +02:00
2024-08-09 09:16:02 +02:00
2024-08-09 09:02:00 +02:00
2024-08-11 08:52:30 +02:00
2024-08-11 09:01:10 +02:00

Edge deployment on microk8s

MicroK8s is a lightweight, fast, and secure Kubernetes distribution designed for developers and edge computing use cases. Developed by Canonical, MicroK8s is a minimalistic version of Kubernetes that can be installed with a single command and runs on various platforms, including Linux, macOS, and Windows. It is ideal for local development, CI/CD pipelines, IoT, and edge deployments due to its small footprint and ease of use. MicroK8s includes essential Kubernetes components and add-ons, such as DNS, storage, and the Kubernetes dashboard, making it a convenient choice for both beginners and experienced Kubernetes users.

In this tutorial, we will guide you through the installation of the Kerberos.io edge stack, which includes the Kerberos Agent, Kerberos Vault, and the Data Filtering Service. This setup enables the storage of recordings from multiple cameras at the edge, facilitating local data processing and ensuring secure and efficient management of video streams.

Install Microk8s

To install MicroK8s on your system, follow these steps. First, ensure that you have snapd installed on your machine. If not, you can install it using the following command:

To install MicroK8s on your system, follow these steps.

  1. Ensure that you have snapd installed on your machine. If not, you can install it using the following command:

    sudo apt update
    sudo apt install snapd
    
  2. Install MicroK8s. Once snapd is installed, you can install MicroK8s with:

    sudo snap install microk8s --classic
    
  3. Add your user to the microk8s group. This step is necessary to avoid using sudo for MicroK8s commands:

    sudo usermod -a -G microk8s $USER
    sudo chown -f -R $USER ~/.kube
    
    
  4. Apply the new group membership. You need to re-enter your session for the group change to take effect:

    su - $USER
    
  5. Check the status of MicroK8s. Ensure that MicroK8s is running correctly:

    microk8s status --wait-ready
    

For more detailed instructions and troubleshooting, please refer to the official MicroK8s documentation.

Dependencies

When installing the Kerberos.io stack, several dependencies are required for storage, such as a database (e.g., MongoDB) and a message broker (e.g., RabbitMQ) for asynchronous behavior. We will install these components before setting up the Kerberos Agents and Kerberos Vault.

One of the key advantages of MicroK8s is its out-of-the-box addons, which can be enabled with a single command. This eliminates the need for complex Helm charts or operators, simplifying the setup process. We will enable some common services, such as DNS, GPU support, and storage, to streamline the installation.

microk8s enable dns
microk8s enable dashboard
microk8s enable gpu
microk8s enable hostpath-storage

You can verify the status of the enabled addons by running the following command:

microk8s.status

Or view the pod status with:

kubectl get po -w -A

Kerberos Vault

OpenEBS

Some of the services we'll leverage such as MongoDB or Minio require storage, to persist their data safely. In a managed Kubernetes cluster, the relevant cloud provider will allocate storage automatically for you, as you might expect this is not the case for a self-hosted cluster.

Therefore we will need to prepare some storage or persistent volume. To simplify this we can leverage the OpenEBS storage solution, which can automatically provision PV (Persistent volumes) for us.

Let us start with installing the OpenEBS operator. Please note that you might need to change the mount folder. Download the openebs-operator.yaml.

wget https://openebs.github.io/charts/openebs-operator.yaml

Scroll to the bottom, until you hit the StorageClass section. Modify the BasePath value to the destination (external mount) you prefer.

#Specify the location (directory) where
# where PV(volume) data will be saved.
# A sub-directory with pv-name will be
# created. When the volume is deleted,
# the PV sub-directory will be deleted.
#Default value is /var/openebs/local
- name: BasePath
  value: "/var/openebs/local/"

Once you are ok with the BasePath go ahead and apply the operator.

kubectl apply -f openebs-operator.yaml

Once done it should start installing several resources in the openebs namespace. If all resources are created successfully we can launch the helm install for MongoDB.

MongoDB

When using Kerberos Vault, it will persist references to the recordings stored in your storage provider in a MongoDB database. As used before, we are using helm to install MongoDB in our Kubernetes cluster. Within the Kerberos Vault project we are using the latest official mongodb driver, so we support all major MongoDB versions (4.x, 5.x, 6.x, 7.x).

Have a look into the ./mongodb/values.yaml file, you will find plenty of configurations for the MongoDB helm chart. To change the username and password of the MongoDB instance, go ahead and find the attribute where you can change the root password. Please note that we are using the official Bitnami Mongodb helm chart, so please use their repository for more indepth configuration.

Next to that you might also consider a SaaS MongoDB deployment using MongoDB Atlas or using a managed cloud like AWS, GCP, Azure or Alibaba cloud. A managed service takes away a lot of management and maintenance from your side (backups, security, sharing, etc). If you do want to install MongoDB in your own cluster then please continue with this tutorial.

helm repo add bitnami https://charts.bitnami.com/bitnami
kubectl create namespace mongodb

Note: If you are installing a self-hosted Kubernetes cluster, we recommend using openebs. Therefore make sure to uncomment the global.storageClass attribute, and make sure it's using openebs-hostpath instead.

helm install mongodb -n mongodb bitnami/mongodb --values ./mongodb-values.yaml
Description
No description provided
Readme 3.8 MiB
Languages
HTML 98.6%
Shell 0.9%
Dockerfile 0.5%