Skip to content
Kubernetes virtual kubelet provider for managing Azure IoT Edge deployments
Branch: master
Clone or download
neumanndaniel and veyalla Adding CPU and memory resource requests and limits (#28)
* Adding CPU and memory resource requests and limits

This PR adds default resource requests and limits for CPU and memory for both containers to the Helm chart.

Implementing Kubernetes best practices.

* Adding CPU and memory resource requests and limits

This PR adds default resource requests and limits for CPU and memory for both containers to the Helm chart.

Implementing Kubernetes best practices.

* Adjustments to fields namespace and apiVersion

This commit adjusts some fields to represent the following changes:
- Reflecting the API version specified in the values.yaml
- Namespace is now reflected correctly instead of having default as fixed value. Now deployments to different namespaces than default are successful

* Adding probe settings

Added additional settings for the livenessProbe and readinessProbe to avoid initial error messages, when starting the pod.

* Clean up

Removed unused parameter rbac.serviceAccountName
Latest commit da27ed4 May 18, 2019

README.md

Azure IoT Edge Connector for Kubernetes

Azure IoT Edge Connector leverages the Virtual Kubelet project to provide a virtual Kubernetes node backed by an Azure IoT hub. It translates a Kubernetes pod specification to an IoT Edge Deployment and submits it to the backing IoT hub. The edge deployment contains a device selector query that controls which subset of edge devices the deployment will be applied to.

This project does not provide Kubernetes-backed high availability or disaster recovery to IoT Edge deployments. It is about software deployment and management of the edge devices using Kubernetes concepts and primitives. Ingress to the edge device is not controlled by the Kubernetes load balancer.

Architecture

iot edge connector

The components provided by this project are depicted in the blue boxes in the diagram above. An IoT Edge provider container is spawned alongside the virtual kubelet container in the same pod. This pod instantiates the IoT Edge Connector virtual node.

The IoT Edge provider handles kubelet API calls forwarded by the virtual kubelet. It talks to the Azure IoT hub using the Azure IoT SDKs to submit an equivalent container specification in form of an IoT Edge deployment manifest.

Kubernetes pod annotations and configmaps are used to encode IoT Edge specific information like module routes and device selector query.

Quick Start

Prerequisites

Install

Quickstart instructions assume an AKS cluster setup, but can be easily translated to any Kubernetes cluster.

  1. Create a Kubernetes secrets store to hold the IoT Hub connection string. To find the connection string, navigate to your IoT Hub resource in the Azure portal and click on "Shared access policies" and the "iothubowner" will contain your connection string.

    kubectl create secret generic my-secrets \
     --from-literal=hub0-cs='<iot-hub-owner-connection-string>'
    

    If you using kubectl from cmd.exe or PowerShell, use double-quotes around the connection string:

    kubectl create secret generic my-secrets --from-literal=hub0-cs="<iot-hub-owner-connection-string>"
    

    Add a new --from-literal entry if you want to store multiple keys

  2. Use Helm, a Kubernetes package manager, to install the iot-edge-connector

    Initialize Helm in the cluster using the following command. If the command is executed for the first time, it may take upto a minute for all Helm components to become ready.

    helm init
    

    Use the command below to allow installation in the Kubernetes default namespace:

    kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
    

    Install the IoT Edge connector.

    helm install -n hub0 src/charts/iot-edge-connector
    

    AKS clusters have RBAC enabled by default, use the following command to install the iot-edge-connector on Kubernetes clusters that don't have RBAC enabled.

    helm install -n hub0 --set rbac.install=false src/charts/iot-edge-connector
    

    After a few seconds kubectl get nodes should show iot-edge-connector0 listed.

  3. Submit the sample Kubernetes deployment.

    kubectl apply -f \
     src/Microsoft.Azure.VirtualKubelet.Edge.Provider/sample-deployment.yaml
    

    The sample deployment contains the simulated temperature sensor container. You can use it as a example to create your own deployment.

    In a few seconds, you should see the deployment show up the IoT Hub portal under IoT Edge Deployments. Example screenshot below:

    tempsensor deployment

Connected edge devices targetted by the deployment will get the new deployment manifest applied within 5 minutes!

More use cases

There are more interesting use cases for this project like:

  • Using a single Kubernetes deployment that controls your cloud-side and device-side software configuration.

  • Creating multiple virtual kubelets (by changing values.yaml in the Helm chart) mapped to different IoT hubs, and scaling the Kubernetes deployment to push the same deployment manifest to edge devices connecting to different hubs. Here is a demo of this use case.

Please give us feedback on how the tool is working for you by tweeting us at @MicrosoftIoT, as well as any feature requests at Azure IoT Edge Feedback or GitHub issues for this repo.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

You can’t perform that action at this time.