Skip to main content
Version: 0.x

Deploy Workloads on Far-Edge Devices

Far-Edge services follow the same flow as normal Kubernetes nodes services. Before deployment the Far-Edge service must be uploaded to a OCI registry.

Pushing embServe Service to OCI registry

To push an service to a registry:

  1. Create a new folder:
mkdir service
  1. Install the oras library:
cd service
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install oras
  1. Create a config.json:
{
"architecture": "arm",
"os": "zephyr",
"variant": "v7"
}
  1. Copy the service manifest to the same folder. Folder should have this structure:
(.venv) user@LABWS:~/Workspace/embserve-sdk/sample$ ls -la
total 20
drwxrwxr-x 2 user user 4096 Sep 26 16:16 .
drwxrwxr-x 8 user user 4096 Sep 26 13:15 ..
-rw-rw-r-- 1 user user 71 Sep 26 16:16 config.json
-rw-rw-r-- 1 user user 2399 Sep 26 16:12 service.json
  1. Upload the device to an OCI registry:
oras push <https://your-image-registry.example.com>/temperature_sensor:1.0.0 --config config.json:application/vnd.oci.image.config.v1+json service.json:application/vnd.embserve.v1+json
note

Don't forget to replace with your registry.

tip

If you want the same reference OCI registry reference to provide both an embServe workload and a Container image, check out the Multi-platform Artifacts documentation.

Creating a Kubernetes deployment for a Far-Edge device

Creating a deployment targeting a Far-Edge device follows the same logic as a normal Kubernetes deployment. Let's create a deployment for the service uploaded in the previous section.

  1. Create a file pod.yaml with:
apiVersion: v1
kind: Pod
metadata:
name: temperature
spec:
containers:
- name: temperature
image: <your-image-registry.example.com>/temperature_sensor:1.0.0
imagePullPolicy: IfNotPresent
nodeSelector:
extra.resources.fhp/embserve: "true"
extra.resources.fhp/temperature_sensor: "true"
tolerations:
- key: "fita.fhp.pt/type"
operator: "Equal"
value: "far-edge"
effect: "NoSchedule"
note

Far-Edge node Kubelet contains a taint which prevents scheduling of Pods. Ensure you add the toleration shown above and filter nodes by using extra.resources.fhp/embserve: "true" as the nodeSelector.

Other labels are available that allows to filter by device capability. Inspect a Far-Edge node to understand what labels are available.

  1. Deploy the Pod:
microk8s kubectl apply -f pod.yaml -n fita
  1. Observe that the Pod was deployed successfully:
kubectl get pods -n fita --output wide

Which should output:

NAME          READY   STATUS    RESTARTS   AGE   IP            NODE
temperature 1/1 Running 0 37s 10.1.42.190 labnuc05-b1-node1