Azure IoT Edge バージョン 1.x から 1.2 へ更新
概要
IoT Edge バージョン 1.2 が GA となり、色々変わりましたので、既存のデバイスに対して更新手順をまとめてみます。
IoT Edge デバイスを更新するには2つのコンポーネント、セキュリティデーモンとランタイムを更新する必要があります。
セキュリティデーモンのコンポーネントはデバイスで実行され、デバイスの起動時にランタイムモジュールを起動する役割です。ランタイムのコンポーネントは IoT Edge ハブと IoT Edge エージェントモジュールに構成されます。
前提条件 : バージョン 1.x 構築
以下の手順で構築されていることを前提とします。
ARM32
Qiitaに投稿した記事がないので、ARM64手順を参考してください。
ARM64
x64(Linux)
Window-x64
1.2バージョンにサポートしてないため、更新できません。
更新前のバージョン確認
セキュリティデーモンのバージョン確認
$ iotedge version
iotedge 1.1.0
ランタイムモジュールのバージョン確認
$ iotedge list | grep -E '^edgeAgent|^edgeHub'
edgeAgent running Up 18 minutes mcr.microsoft.com/azureiotedge-agent:1.1
edgeHub running Up 18 minutes mcr.microsoft.com/azureiotedge-hub:1.1
バージョン 1.x アンインストール
$ sudo systemctl stop iotedge
$ sudo apt remove iotedge
$ sudo apt remove libiothsm-std
バージョン 1.2 インストール
セキュリティデーモンのインストール
$ sudo apt-get update
$ apt list -a aziot-edge
...
aziot-edge/bionic 1.2.0-1 arm64
aziot-edge/bionic 1.2.0~rc4-1 arm64
...
$ sudo apt-get install -y aziot-edge
ARM64で更新作業を行っているため、ARM64のみ見えてます。
構成ファイルの更新
$ iotedge version
iotedge 1.1.0
$ iotedge list | grep -E '^edgeAgent|^edgeHub'
edgeAgent running Up 18 minutes mcr.microsoft.com/azureiotedge-agent:1.1
edgeHub running Up 18 minutes mcr.microsoft.com/azureiotedge-hub:1.1
$ sudo systemctl stop iotedge
$ sudo apt remove iotedge
$ sudo apt remove libiothsm-std
バージョン 1.2 インストール
セキュリティデーモンのインストール
$ sudo apt-get update
$ apt list -a aziot-edge
...
aziot-edge/bionic 1.2.0-1 arm64
aziot-edge/bionic 1.2.0~rc4-1 arm64
...
$ sudo apt-get install -y aziot-edge
ARM64で更新作業を行っているため、ARM64のみ見えてます。
構成ファイルの更新
$ sudo apt-get update
$ apt list -a aziot-edge
...
aziot-edge/bionic 1.2.0-1 arm64
aziot-edge/bionic 1.2.0~rc4-1 arm64
...
$ sudo apt-get install -y aziot-edge
ARM64で更新作業を行っているため、ARM64のみ見えてます。
構成ファイルが/etc/iotedge/config.yaml
から/etc/aziot/config.toml
に名前と場所が新しくなってため、 インポートしておきます。
$ sudo iotedge config import
Azure IoT Edge has been configured successfully!
The configuration has been written to /etc/aziot/config.toml
To apply the new configuration to services, run:
sudo iotedge config apply -c '/etc/aziot/config.toml'
$ sudo iotedge config apply -c '/etc/aziot/config.toml'
Note: Symmetric key will be written to /var/secrets/aziot/keyd/device-id
Note: Imported master encryption key will be written to /var/secrets/aziot/keyd/imported-master-encryption-key
Azure IoT Edge has been configured successfully!
Restarting service for configuration to take effect...
Stopping aziot-edged.service...Stopped!
Stopping aziot-identityd.service...Stopped!
Stopping aziot-keyd.service...Stopped!
Stopping aziot-certd.service...Stopped!
Stopping aziot-tpmd.service...Stopped!
Starting aziot-edged.mgmt.socket...Started!
Starting aziot-edged.workload.socket...Started!
Starting aziot-identityd.socket...Started!
Starting aziot-keyd.socket...Started!
Starting aziot-certd.socket...Started!
Starting aziot-tpmd.socket...Started!
Starting aziot-edged.service...Started!
Done.
更新完了時は下記のようにedgeAgentモジュールしか見えないですが、しばらくすると既存のDeployment Manifestの通り、モジュールが構成されます。
$ iotedge list
NAME STATUS DESCRIPTION CONFIG
edgeAgent running Up 13 seconds mcr.microsoft.com/azureiotedge-agent:1.0
ランタイムモジュールの更新
ランタイムモジュールはリモートで「Deployment Manifest」を作成して更新できます。
下記のベース「Deployment Manifest」を参考し、Visual Studio Codeなどでデプロイしてください。
{
"$schema-template": "2.0.0",
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"schemaVersion": "1.1",
"runtime": {
"type": "docker",
"settings": {
"minDockerVersion": "v1.25",
"loggingOptions": "",
"registryCredentials": {}
}
},
"systemModules": {
"edgeAgent": {
"type": "docker",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-agent:1.2",
"createOptions": "{}"
}
},
"edgeHub": {
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-hub:1.2",
"createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"
}
}
},
"modules": {
}
}
},
"$edgeHub": {
"properties.desired": {
"schemaVersion": "1.1",
"routes": {},
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
}
}
}
}
}
$ iotedge list
NAME STATUS DESCRIPTION CONFIG
edgeAgent running Up 3 minutes mcr.microsoft.com/azureiotedge-agent:1.2
edgeHub running Up 3 minutes mcr.microsoft.com/azureiotedge-hub:1.2
注意点
Azure IoT Edge 1.2 では Linuxデバイスのみ使用できることや様々な機能を追加され、内部仕組みも変わりましたが、LTSサポートではないことを認識する必要があります。
One more thing
IoT EdgeデバイスにDeployment Manifestを作成するには下記のウェブサイトで作成することをお勧めします。
まだ、1.2対応ができてないですが、ダウンロードしたDeployment Manifestから簡単に修正できます。
Author And Source
この問題について(Azure IoT Edge バージョン 1.x から 1.2 へ更新), 我々は、より多くの情報をここで見つけました https://qiita.com/motoJinC25/items/e1de510d9480596eeb36著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .