⚠️ Deprecation notice
This preview integration of IoT Edge 1.x and Kubernetes will not be made generally available, and is no longer supported. The recommended way to run IoT Edge 1.x on Kubernetes is noted in the product's official docs
Azure IoT Edge on Kubernetes Connnected to IoT Central
This tutorial demonstrates a scenario of deploying a simulated temperature sensor edge module. It requires a Kubernetes cluster with Helm initialized and kubectl
installed as noted in the prerequisites. This tutorial will use an AKS cluster deployed on Azure.
IoT Central Prerequisites
-
Follow the Prerequisites section of this doc to setup an IoT Central application
-
Create a device template, follow the section in this doc
-
Add IoT Edge Device, follow the section in this doc
Setup steps for provisoning Edge device to Central
-
Once you have an AKS cluster deployed go to shell.azure.com
-
Set your subscription where you deployed AKS cluster
$ az account set --subscription "<your azure subscription name>"
-
To get Credentials run the following command
$ az aks get-credentials --resource-group <your resource group name> --name <your AKS cluster name>
-
Install Helm
$ wget https://get.helm.sh/helm-v3.3.0-rc.1-linux-amd64.tar.gz $ tar -zxvf helm-v3.3.0-rc.1-linux-amd64.tar.gz
-
Create a Kubernetes namespace to install the edge deployment into.
kubectl create ns helloworld
-
Install IoT Edge Custom Resource Definition (CRD).
helm install --repo https://edgek8s.blob.core.windows.net/staging edge-crd edge-kubernetes-crd
-
Deploy the edge workload into the previously created K8s namespace.
For simplicity, this tutorial doesn't specify a persistent store for
iotedged
during install. However, for any serious/PoC deployment, follow the best practice example shown in the iotedged failure resilience tutorial.# Install edge deployment into the created namespace, get scope id, symmetric key and device id/registration id from IoT Central. In IoT Central go to device explorer, select your edge device and click **Connect** button to get the details. helm install --repo https://edgek8s.blob.core.windows.net/staging edge1 edge-kubernetes \ --namespace helloworld \ --set "provisioning.source=dps" \ --set "provisioning.globalEndpoint=https://global.azure-devices-provisioning.net" \ --set "provisioning.scopeId=<your scope id>" \ --set "provisioning.attestation.method=symmetric_key" \ --set "provisioning.attestation.registration_id=<your device id>" \ --set "provisioning.attestation.symmetric_key=<your device symmetric key>" \
-
In a couple of minutes, you should see the workload modules defined in the edge deploymentment running as pods along with
edgeagent
andiotedged
. Confirm this using:kubectl get pods -n helloworld
Cleanup
# Cleanup
helm del edge1 -n helloworld && \
kubectl delete ns helloworld
...will remove all the Kubernetes resources deployed as part of the edge deployment in this example (IoT Edge CRD will not be deleted).