Getting started with Flotta Operator Part 1

Published on Feb 03, 2022 by Ondra Machacek on guide flotta

In this blog post series we would like to show you how to get started with the Flotta project. The Flotta operator is the Kubernetes operator used to manage the workloads of the edge devices via Kubernetes API. In order to manage the edgedevices and workloads you need to have Kubernetes or OpenShift up and running. Unfortunately the Flotta operator is not yet published on the operator hub, so we have to deploy it manually from the github repo.

Install Prerequisites for Flotta Operator

Following are the prerequisites:

 - Kubernetes or OpenShift cluster running with kubectl configured
 - Cert manager
 - OpenShift route
 - Noobaa (optional)

Flotta requires the cert manager for TLS key management for webhooks, so if you don’t have it up and running on your cluster, you can execute following command to install it:

$ kubectl apply -f
$ kubectl wait --for=condition=Ready pods --all -n cert-manager --timeout=60s

In addition, OpenShift router is needed for passing-through incoming TLS traffic into Flotta Edge API that handles incoming requests from the edge devices. For non-_OCP_ clusters types (k8s, kind, minikube), use the following command to install it:

$ kubectl apply -f
$ kubectl apply -f
$ kubectl apply -f
$ kubectl wait --for=condition=Ready pods --all -n openshift-ingress --timeout=60s

Noobaa is data service that provides S3 object-store interface. Flotta’s Edge API enables edge devices to send application data to S3 endpoint, into a bucket claim created automatically for each device at registration time. By default, Object Bucket Claim (OBC) auto-creation is disabled. To enable it, follow the instructions below. To use Noobaa to create a bucket claim for each device on registration you must enable OBC auto-creation.

For Installing Noobaa on the cluster, follow Noobaa’s installation guide. Note that Noobaa requires additional resources, therefore additional memory and CPU are needed (+2 cpu, +5Gi memory). Noobaa also requires a local storage class and a default storage class to be present on the cluster.

Install Flotta Operator

To deploy the latest version of the Flotta operator execute following command:

For OpenShift Container Platform (OCP):

$ kubectl apply -f

For kubernetes:

$ kubectl apply -f

By default, the Flotta operator is deployed in flotta namespace.

$ kubectl get all -n flotta
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

NAME                                                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
service/flotta-controller-manager-metrics-service   ClusterIP    <none>        8443/TCP,8080/TCP            3d17h
service/flotta-edge-api                             ClusterIP     <none>        8043/TCP,8080/TCP,8443/TCP   3d17h
service/flotta-webhook-service                      ClusterIP   <none>        443/TCP                      3d17h

NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/flotta-controller-manager   1/1     1            1           3d17h
deployment.apps/flotta-edge-api             1/1     1            1           3d17h

NAME                                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/flotta-controller-manager-7fd45874c6   1         1         1       3d17h
replicaset.apps/flotta-edge-api-8649fbb9dc             1         1         1       3d17h

NAME                                       HOST/PORT           PATH   SERVICES          PORT    TERMINATION   WILDCARD          flotta-edge-api   yggds   passthrough   None

Flotta operator deploys two CustomResourceDefinitions (CRDs):

  1. EdgeWorkloads, used to manage the workloads.
  2. EdgeDevices used to manage the devices.
  3. EdgeDeviceSet used to manage set of devices.
  4. EdgeDeviceSignedRequest used to manage approval of devices.
$ kubectl get crd | grep               2022-05-15T13:25:11Z            2022-05-15T13:25:11Z   2022-05-15T13:25:11Z             2022-05-15T13:25:11Z

By default, both operator manifests (for OCP and k8s) assume ObjectBucketClaim CRD is installed on the cluster. If it is not installed, there are two options, based on the needs:

Enable Object Bucket Claim Auto Creation

To enable ObjectBucketClaim auto-creation, Flotta’s operator config map needs to be patched and Flotta’s operator needs to be restarted:

kubectl patch cm -n flotta flotta-manager-config --type merge --patch '{ "data": { "OBC_AUTO_CREATE": "true"} }'
kubectl rollout restart deploy/flotta-controller-manager -n flotta

That’s it for the operator side, next time we will take a look how to provision a machine with edge device, where we will deploy a simple nginx workload.

Similar Stories