Run flotta on minikube

Flotta can run on top of any Kubernetes distributions, for testing and development you can follow this guide to get started running flotta on your devices.

Let’s start with minikube

---> minikube start
πŸ˜„  minikube v1.22.0 on Fedora 35
πŸŽ‰  minikube 1.25.2 is available! Download it:
πŸ’‘  To disable this notice, run: 'minikube config set WantUpdateNotification false'

✨  Automatically selected the docker driver
πŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
πŸ”₯  Creating docker container (CPUs=2, Memory=3900MB) ...

🧯  Docker is nearly out of disk space, which may cause deployments to fail! (95% of capacity)
πŸ’‘  Suggestion:

    Try one or more of the following to free up space on the device:

    1. Run "docker system prune" to remove unused Docker data (optionally with "-a")
    2. Increase the storage allocated to Docker for Desktop by clicking on:
    Docker icon > Preferences > Resources > Disk Image Size
    3. Run "minikube ssh -- docker system prune" if using the Docker container runtime
🍿  Related issue:

🐳  Preparing Kubernetes v1.21.2 on Docker 20.10.7 ...
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”Ž  Verifying Kubernetes components...
    β–ͺ Using image
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Check minikube status:

---> minikube status
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

Flotta operator has a few tools that helps to install flotta, for that, let’s clone it:

git clone -b main --depth 1
cd flotta-operator

First, we need to install Openshift-router, the ingress that it’s supported now:

---> make install-router
kubectl apply -f created created created
namespace/openshift-ingress created
serviceaccount/ingress-router created
kubectl apply -f created
kubectl apply -f
deployment.apps/ingress-router created
kubectl wait --for=condition=Ready pods --all -n openshift-ingress --timeout=60s
pod/ingress-router-5b9b477c98-gx5pl condition met

Now let’s install Flotta on the cluster:

make deploy TARGET=k8s

A bunch of CRDs are now created, where the definitions can be found here:

---> kubectl  api-resources | grep flotta
edgeconfigs                             true         EdgeConfig
edgedevices                             true         EdgeDevice
edgedevicesets                          true         EdgeDeviceSet
edgedevicesignedrequest           edsr   true         EdgeDeviceSignedRequest
edgeworkloads                           true         EdgeWorkload
playbookexecutions                      true         PlaybookExecution

At the same time, in the flotta namespace the operator and the edge-api pods should be running:

---> kubectl -n flotta get pods
NAME                                             READY   STATUS    RESTARTS        AGE
pod/flotta-controller-manager-7fd45874c6-wxxfv   2/2     Running   0               3d17h
pod/flotta-edge-api-8649fbb9dc-bt4r9             2/2     Running   0               3d17h

Flotta is now running and ready to register edgedevices. To register a edgedevice we need first to retrieve the install scripts using the Makefile target agent-install-scripts.

make agent-install-scripts

Now, two scripts are created:

  • hack/ To install on normal Fedora installations
  • hack/ To install on rpm-ostree devices.

Minikube is a local virtual machine, so $ minikube ip cannot be reached from your edgedevice, for sharing the flotta API port to the edgedevice the best way is to use kubectl port-forward:

$ kubectl port-forward service/flotta-edge-api -n flotta 8043 --address

On the device, with Fedora already installed, we need to execute the following:

$ sudo hack/ -i

Where is your host ip.

After a while, if you list the devices in your cluster, you can see that the edgedevice is already registered:

---> kubectl get edgedevices
NAME        AGE
camera-ny   118s

From here, you should be able to deploy workloads to these devices. As explained here