Azure / iot-edge-virtual-kubelet-provider

Kubernetes virtual kubelet provider for managing Azure IoT Edge deployments
MIT License
94 stars 25 forks source link

apply target condition to an edge device #31

Closed soheilade closed 5 years ago

soheilade commented 5 years ago

after deploying sample-deployment.yaml, kubectl get pods returns

NAME                                       READY   STATUS    RESTARTS   AGE
tempsensor-5bc6db6876-bw7sg                0/1     Running   0          15m

i wonder why the READY is 0/1?

here is the outcome of kubectl describe pod tempsensor

Name:               tempsensor-5bc6db6876-bw7sg
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               iot-edge-connector-hub0/
Labels:             app=tempSensor
                    pod-template-hash=5bc6db6876
Annotations:        isEdgeDeployment: true
                    loggingOptions:
                    priority: 15
                    targetCondition: tags.building='b43'
Status:             Running
IP:
Controlled By:      ReplicaSet/tempsensor-5bc6db6876
Containers:
  tempsensor:
    Image:        mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0
    Port:         <none>
    Host Port:    <none>
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-7ptcd (ro)
Conditions:
  Type           Status
  Initialized    True
  Ready          True
  PodScheduled   True
Volumes:
  default-token-7ptcd:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-7ptcd
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  type=virtual-kubelet
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
                 virtual-kubelet.io/provider=iotedge:NoSchedule
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  17m   default-scheduler  Successfully assigned default/tempsensor-5bc6db6876-bw7sg to iot-edge-connector-hub0`

Also my IOTedge deployments are not applied to any of my IoTedge devices. image

image

is my IoTEdgedevice missing the target condition? how to set this target condition on the device?

veyalla commented 5 years ago

@soheilade That is correct. See step 2 in this lab for an example on how to set this from the az CLI: https://github.com/veyalla/el1#add-an-iot-edge-device-in-iot-hub

 az iot hub device-twin update --device-id replace-with-deviceid --hub-name replace-with-hubname --set tags='{"building":"b43"}'

It can be done from the IoT Hub portal as well:

This lab has a more detailed walkthru, but I've not updated it for a while: https://github.com/veyalla/iot-edge-custom-vision-kubernetes-lab

soheilade commented 5 years ago

@veyalla , thanks, indeed useful.