次の方法で共有


アプリケーションをアタッチする (プレビュー)

この記事では、永続ボリューム (PV) と永続ボリューム要求 (PVC) を作成していることを前提としています。 PV の作成に関する詳細については、「永続ボリュームを作成する」を参照してください。 PVC の作成に関する詳細については、「永続ボリューム要求を作成する」を参照してください。

Azure IoT Operations データ プロセッサを構成する

Azure IoT Operations (AIO) を使用すると、Edge Storage Accelerator のマウントなしでデータ プロセッサが生成されます。 実行できるタスクは次のとおりです。

  • 前に作成した Edge Storage Accelerator PVC のマウントを追加します。
  • すべてのパイプラインの出力ステージを、作成した Edge Storage Accelerator マウントに出力するように再構成します。

aio-dp-runner-worker-0 ポッドに Edge Storage Accelerator を追加する

これらのポッドは statefulSet の一部です。 statefulSet をその場で編集して、マウント ポイントを追加することはできません。 代わりに、次の手順に従います。

  1. statefulSet を yaml にダンプします。

    kubectl get statefulset -o yaml -n azure-iot-operations aio-dp-runner-worker > stateful_worker.yaml
    
  2. statefulSet を編集して、volumeMounts とvolume に次の ESA の新しいマウントを含めます。

    volumeMounts: 
    - mountPath: /etc/bluefin/config 
      name: config-volume 
      readOnly: true 
    - mountPath: /var/lib/bluefin/registry 
      name: nfs-volume 
    - mountPath: /var/lib/bluefin/local 
      name: runner-local
      ### Add the next 2 lines ###
    - mountPath: /mnt/esa 
      name: esa4 
    
    volumes: 
    - configMap: 
        defaultMode: 420 
        name: file-config 
      name: config-volume 
    - name: nfs-volume 
    persistentVolumeClaim: 
      claimName: nfs-provisioner
      ### Add the next 3 lines ### 
    - name: esa4 
      persistentVolumeClaim: 
        claimName: esa4
    
  3. 既存の statefulSet を削除します。

    kubectl delete statefulset -n azure-iot-operations aio-dp-runner-worker
    

    これにより、すべての aio-dp-runner-worker-n ポッドが削除されます。 これは停止レベルのイベントです。

  4. ESA マウントを使用して aio-dp-runner-worker の新しい statefulSet を作成します。

    kubectl apply -f stateful_worker.yaml -n azure-iot-operations
    

    aio-dp-runner-worker-n ポッドが起動すると、ESA へのマウントが含まれます。 PVCは状態でこれを伝える必要があります。

  5. ESA ボリュームにアクセスできるようにデータ プロセッサ ワーカーを再構成したら、ワーカー POD 上の ESA ボリュームのマウント位置に対応するローカル パスを使用するように、手動でパイプライン設定を更新する必要があります。

    パイプラインを変更するには、kubectl edit pipeline <name of your pipeline> を使用します。 そのパイプラインで、出力ステージを次の YAML に置き換えます。

    output:
      batch:
        path: .payload
        time: 60s
      description: An example file output stage
      displayName: Sample File output
      filePath: '{{{instanceId}}}/{{{pipelineId}}}/{{{partitionId}}}/{{{YYYY}}}/{{{MM}}}/{{{DD}}}/{{{HH}}}/{{{mm}}}/{{{fileNumber}}}'
      format:
        type: jsonStream
      rootDirectory: /mnt/esa
      type: output/file@v1
    

Kubernetes ネイティブ アプリケーションを構成する

  1. 永続ボリューム要求 (PVC) に対して一般的な単一ポッド (Kubernetes ネイティブ アプリケーション) を構成するには、次の内容を含む configPod.yaml という名前のファイルを作成します。

    kind: Deployment
    apiVersion: apps/v1
    metadata:
      name: example-static
      labels:
        app: example-static
      ### Uncomment the next line and add your namespace only if you are not using the default namespace (if you are using azure-iot-operations) as specified from Line 6 of your pvc.yaml. If you are not using the default namespace, all future kubectl commands require "-n YOUR_NAMESPACE" to be added to the end of your command.
      # namespace: YOUR_NAMESPACE
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: example-static
      template:
        metadata:
          labels:
            app: example-static
        spec:
          containers:
            - image: mcr.microsoft.com/cbl-mariner/base/core:2.0
              name: mariner
              command:
                - sleep
                - infinity
              volumeMounts:
                ### This name must match the 'volumes.name' attribute in the next section. ###
                - name: blob
                  ### This mountPath is where the PVC is attached to the pod's filesystem. ###
                  mountPath: "/mnt/blob"
          volumes:
            ### User-defined 'name' that's used to link the volumeMounts. This name must match 'volumeMounts.name' as specified in the previous section. ###
            - name: blob
              persistentVolumeClaim:
                ### This claimName must refer to the PVC resource 'name' as defined in the PVC config. This name must match what your PVC resource was actually named. ###
                claimName: YOUR_CLAIM_NAME_FROM_YOUR_PVC
    

    Note

    独自の名前空間を使用している場合は、今後すべての kubectl コマンドには -n YOUR_NAMESPACE を追加する必要があります。 たとえば、標準的な kubectl get pods の代わりに kubectl get pods -n YOUR_NAMESPACE を使用する必要があります。

  2. この .yaml ファイルを適用するには、次のコマンドを実行します。

    kubectl apply -f "configPod.yaml"
    
  3. kubectl get pods を使用して、ポッドの名前を検索します。 次の手順で必要になるので、この名前をコピーしておいてください。

  4. 次のコマンドを実行し、POD_NAME_HERE を前の手順でコピーした値に置き換えます。

    kubectl exec -it POD_NAME_HERE -- bash
    
  5. configPod.yaml から指定された /mnt/blob マウント パスにディレクトリを変更します。

  6. たとえば、ファイルを書き込むには、touch file.txt を実行します。

  7. Azure portal で、ストレージ アカウントに移動し、コンテナーを検索します。 これは pv.yaml ファイルで指定したのと同じコンテナーです。 コンテナーを選択すると、コンテナー内に file.txt が表示されます。

次のステップ

これらの手順を完了したら、Azure Monitor と Kubernetes の監視を使用してデプロイの監視を開始するか、Prometheus と Grafana を使用してサードパーティの監視を開始します。

サード パーティ製の監視