⚠️ 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 This example demonstrates a "Hello, world" 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.

Setup steps

  1. Register an IoT Edge device and deploy the simulated temperature sensor module. Be sure to note the device's connection string.

  2. Create a Kubernetes namespace to install the edge deployment into.

    kubectl create ns helloworld
    
  3. Install IoT Edge Custom Resource Definition (CRD).

    helm install --repo https://edgek8s.blob.core.windows.net/staging edge-crd edge-kubernetes-crd  
    
  4. 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.

    
    # Store the device connection string in a variable (enclose in single quotes)
    export connStr='replace-with-device-connection-string-from-step-1'
    
    # Install edge deployment into the created namespace
    helm install --repo https://edgek8s.blob.core.windows.net/staging edge1 edge-kubernetes \
      --namespace helloworld \
      --set "provisioning.deviceConnectionString=$connStr"
    
    
  5. In a couple of minutes, you should see the workload modules defined in the edge deploymentment running as pods along with edgeagent and iotedged. Confirm this using:

    kubectl get pods -n helloworld
    
    # View the logs from the simlulated temperature sensor module
    kubectl logs -n helloworld replace-with-temp-sensor-pod-name simulatedtemperaturesensor
    

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).