|Index|SUSE Telco Cloud ドキュメント|完全自動化されたダイレクトネットワークプロビジョニング|接続されたシナリオ向けのダウンストリームクラスターイメージの準備
適用項目 SUSE Telco Cloud 3.7

50 接続されたシナリオ向けのダウンストリームクラスターイメージの準備

Edge Image Builder (第12章 「Edge Image Builder」)は、ダウンストリームクラスター ホストにプロビジョニングされる変更済みのSLEMicroベースイメージを準備するために使用されます。

Edge Image Builderによる構成の多くは可能ですが、本ガイドでは、ダウンストリームクラスターをセットアップするために必要な最小限の構成について説明します。

50.1 接続されたシナリオの前提条件

注記
注記

ビルドするイメージと同じアーキテクチャのビルドホストを使用する必要があります。つまり、`aarch64`イメージをビルドするには`aarch64`ビルドホストを使用する必要があり、`x86-64`の場合も同様です(現時点ではクロスビルドはサポートされていません)。

50.2 接続されたシナリオのイメージ構成

Edge Image Builderを実行する際、ホストからディレクトリがマウントされるため、ターゲットイメージの定義に使用する設定ファイルを保存するためのディレクトリ構造を作成する必要があります。

  • `downstream-cluster-config.yaml`はイメージ定義ファイルです。詳細については第5章 「Edge Image Builderを使用したスタンドアロンクラスター」を参照してください。

  • ベースイメージフォルダーには、ガイド第65章 「Kiwiを使用して更新されたSUSE Linux Microイメージを構築する」に従いプロファイル`Base`(またはリアルタイムカーネルの場合は`Base-RT`)を使用して生成された出力RAWイメージが含まれます。これを`base-images`フォルダーの下にコピーまたは移動する必要があります。

  • `custom/files`ディレクトリには、イメージ作成プロセス中にイメージにコピーされる`performance-settings.sh`ファイルと`sriov-auto-filler.sh`ファイルが含まれています。

  • `custom/scripts`ディレクトリには、初回起動時に実行されるスクリプトが含まれています。

    1. `01-fix-growfs.sh`スクリプトは、デプロイ時にOSルートパーティションのサイズを変更するために必要です。

    2. `02-performance.sh`スクリプトはオプションであり、パフォーマンスチューニング用にシステムを構成するために使用できます。

    3. `03-sriov.sh`スクリプトはオプションであり、SR-IOV用にシステムを構成するために使用できます。

  • `network`フォルダーはオプションです。詳細については50.2.6項 「高度なネットワーク構成用の追加スクリプト」を参照してください。

  • `os-files`フォルダーには、各ノードの起動時に必要なオプションを指定して`sctp`カーネルモジュールと`vfio-pci`カーネルモジュールをロードするために必要な設定ファイルが含まれています。

├── downstream-cluster-config.yaml
├── base-images
│   └── SL-Micro.x86_64-6.2-Base-GM.raw
├── custom
│   ├── files
│   │   ├── performance-settings.sh
│   │   └── sriov-auto-filler.sh
│   └── scripts
│       ├── 01-fix-growfs.sh
│       ├── 02-performance.sh
│       └── 03-sriov.sh
├── network
│   └── configure-network.sh
└── os-files
    └── etc
        ├── modprobe.d
        │   └── vfio-pci-options.conf
        └── modules-load.d
            ├── sctp.conf
            └── vfio-pci.conf

50.2.1 ダウンストリームクラスターイメージ定義ファイル

`downstream-cluster-config.yaml`ファイルは、ダウンストリームクラスターイメージのメイン設定ファイルです。Metal3を介したデプロイメントの最小限の例を次に示します。

apiVersion: 1.3
image:
  imageType: raw
  arch: x86_64
  baseImage: SL-Micro.x86_64-6.2-Base-GM.raw
  outputImageName: eibimage-output-telco.raw
operatingSystem:
  kernelArgs:
    - ignition.platform.id=openstack
  systemd:
    disable:
      - rebootmgr
      - transactional-update.timer
      - transactional-update-cleanup.timer
      - fstrim
      - time-sync.target
  users:
    - username: root
      encryptedPassword: $ROOT_PASSWORD
      sshKeys:
      - $USERKEY1
      createHomeDir: true
  packages:
    packageList:
      - jq
    sccRegistrationCode: $SCC_REGISTRATION_CODE

`$SCC_REGISTRATION_CODE`は SUSE Customer Centerからコピーした登録コードであり、パッケージリストには必要な`jq`が含まれています。

`$ROOT_PASSWORD`はルートユーザの暗号化されたパスワードであり、テストやデバッグに役立ちます。 これは`openssl passwd -6 PASSWORD`コマンドで生成できます。

本番環境では、`$USERKEY1`を実際のSSHキーに置き換えてusersブロックに追加できるSSHキーを使用することをお勧めします。

注記
注記

`arch: x86_64`はイメージのアーキテクチャです。arm64アーキテクチャの場合は、`arch: aarch64`を使用してください。

`ignition.platform.id=openstack`は必須であることに注意してください。この引数がないと、Metal3の自動フローによるSLEMicroの設定は失敗します。

SUSE Linux Micro 6.2より前のバージョンでは、 Predictable Network Interface Namingを有効にするために、`net.ifnames=1`をカーネル引数として明示的に設定する必要があります。これは6.2以降ではデフォルトで適用されるため、明示的な設定は不要です。これは、管理クラスターのMetal3 Helmチャートの`predictableNicNames`設定と一致しており、ダイレクトネットワークプロビジョニングが正しく機能するために必要です。SR-IOVを利用する場合、一貫したインターフェース命名も不可欠です。

50.2.2 Growfsスクリプト

現在、プロビジョニング後の初回起動時にディスクサイズに合わせてファイルシステムを拡張するには、カスタムスクリプト(custom/scripts/01-fix-growfs.sh)が必要です。`01-fix-growfs.sh`スクリプトには、次の情報が含まれています。

#!/bin/bash
growfs() {
  mnt="$1"
  dev="$(findmnt --fstab --target ${mnt} --evaluate --real --output SOURCE --noheadings)"
  # /dev/sda3 -> /dev/sda, /dev/nvme0n1p3 -> /dev/nvme0n1
  parent_dev="/dev/$(lsblk --nodeps -rno PKNAME "${dev}")"
  # Last number in the device name: /dev/nvme0n1p42 -> 42
  partnum="$(echo "${dev}" | sed 's/^.*[^0-9]\([0-9]\+\)$/\1/')"
  ret=0
  growpart "$parent_dev" "$partnum" || ret=$?
  [ $ret -eq 0 ] || [ $ret -eq 1 ] || exit 1
  /usr/lib/systemd/systemd-growfs "$mnt"
}
growfs /

50.2.3 パフォーマンススクリプト

次のオプションのスクリプト(custom/scripts/02-performance.sh)を使用して、パフォーマンスチューニング用にシステムを設定できます。

#!/bin/bash

# create the folder to extract the artifacts there
mkdir -p /opt/performance-settings

# copy the artifacts
cp performance-settings.sh /opt/performance-settings/

custom/files/performance-settings.sh の内容は、パフォーマンスチューニング用にシステムを設定するために使用できるスクリプトであり、次の https://github.com/suse-edge/telco-cloud-examples/blob/release-3.7/telco-examples/downstream-clusters/dhcp/eib/custom/files/performance-settings.sh [link] からダウンロードできます。

50.2.4 SR-IOVスクリプト

次のオプションのスクリプト(custom/scripts/03-sriov.sh)を使用して、SR-IOV用にシステムを設定できます。

#!/bin/bash

# create the folder to extract the artifacts there
mkdir -p /opt/sriov
# copy the artifacts
cp sriov-auto-filler.sh /opt/sriov/sriov-auto-filler.sh

custom/files/sriov-auto-filler.sh の内容は、SR-IOV 用にシステムを構成するために使用できるスクリプトであり、以下の link からダウンロードできます。

注記
注記

同じアプローチを使用して、プロビジョニングプロセス中に実行される独自のカスタムスクリプトを追加します。 詳細については、第5章 「Edge Image Builderを使用したスタンドアロンクラスター」を参照してください。

50.2.5 通信ワークロードの追加構成

dpdk、sr-iov、または FEC などの通信機能を有効にするには、次の例に示すように追加のパッケージが必要になる場合があります。

apiVersion: 1.3
image:
  imageType: raw
  arch: x86_64
  baseImage: SL-Micro.x86_64-6.2-Base-GM.raw
  outputImageName: eibimage-output-telco.raw
operatingSystem:
  kernelArgs:
    - ignition.platform.id=openstack
  systemd:
    disable:
      - rebootmgr
      - transactional-update.timer
      - transactional-update-cleanup.timer
      - fstrim
      - time-sync.target
  users:
    - username: root
      encryptedPassword: $ROOT_PASSWORD
      sshKeys:
      - $user1Key1
      createHomeDir: true
  packages:
    packageList:
      - jq            # Non Telco specific - category: testing/utils
      - dpdk          # TelCo Core-Network UserPlane (5G UPF) and RAN UserPlane (gNB: DU and CU-UP) - category: runtime
      - dpdk-tools    # TelCo Core-Network UserPlane (5G UPF) and RAN UserPlane (gNB: DU and CU-UP) - category: testing/utils
      - libdpdk-25    # TelCo Core-Network UserPlane (5G UPF) and RAN UserPlane (gNB: DU and CU-UP) - category: runtime
      - pf-bb-config  # TelCo RAN (gNB: DU) - category: config.
      - open-iscsi    # Non Telco specific (required by SUSE Storage/Longhorn) - category: runtime
      - tuned         # Non Telco specific (linux tuning) - category: config.
      - cpupower      # Non Telco specific (linux tuning - CPU power related settings) - category: config.
      - rt-tests      # Non Telco specific (RT scheduler-latency testing) - category: testing/utils
      - linuxptp      # TelCo RAN; time sync (gNB: DU) - category: runtime
      - synce4l       # TelCo RAN; time sync (gNN: DU) - category: runtime
      - pciutils      # Non Telco specific (provides "lspci" command) - category: testing/utils
      - numactl       # Non Telco specific (provides "numactl" command) - category: testing/utils
    sccRegistrationCode: $SCC_REGISTRATION_CODE

ここで $SCC_REGISTRATION_CODE は SUSE Customer Center からコピーされた登録コードであり、パッケージリストには通信プロファイルに使用される最小限のパッケージが含まれています。

注記
注記

`arch: x86_64`はイメージのアーキテクチャです。arm64アーキテクチャの場合は、`arch: aarch64`を使用してください。

50.2.6 高度なネットワーク構成用の追加スクリプト

第54章 「高度なネットワーク設定」 で説明されているように、静的 IP やより高度なネットワークシナリオを構成する必要がある場合は、以下の追加構成が必要です。

network フォルダーに次の configure-network.sh 設定ファイルを作成します。これは初回起動時に構成ドライブデータを消費し、 NM Configurator tool を使用してホストネットワークを構成します。

#!/bin/bash

set -eux

# Attempt to statically configure a NIC in the case where we find a network_data.json
# In a configuration drive

CONFIG_DRIVE=$(blkid --label config-2 || true)
if [ -z "${CONFIG_DRIVE}" ]; then
  echo "No config-2 device found, skipping network configuration"
  exit 0
fi

mount -o ro $CONFIG_DRIVE /mnt

META_DATA_FILE="/mnt/openstack/latest/meta_data.json"
if [ ! -f "${META_DATA_FILE}" ]; then
  umount /mnt
  echo "No meta_data.json found, skipping hostname configuration"
  exit 0
fi

DESIRED_HOSTNAME=$(cat /mnt/openstack/latest/meta_data.json | tr ',{}' '\n' | grep '"metal3-name"' | sed 's/.*\"metal3-name\": \"\(.*\)\"/\1/')
echo "${DESIRED_HOSTNAME}" > /etc/hostname

NETWORK_DATA_FILE="/mnt/openstack/latest/network_data.json"

if [ ! -f "${NETWORK_DATA_FILE}" ]; then
  umount /mnt
  echo "No network_data.json found, skipping network configuration"
  exit 0
fi

mkdir -p /tmp/nmc/{desired,generated}
cp ${NETWORK_DATA_FILE} /tmp/nmc/desired/_all.yaml
umount /mnt

./nmc generate --config-dir /tmp/nmc/desired --output-dir /tmp/nmc/generated
./nmc apply --config-dir /tmp/nmc/generated

50.2.7 通信に必要なカーネルモジュール

通信ワークロードに必要なカーネルモジュールが各ノードの起動時に読み込まれるようにするには、以下の設定ファイルを os-files EIB フォルダーに追加する必要があります。

50.2.7.1 sctp.conf

os-files/etc/modules-load.d/ パスに配置し、 systemd-modules-load.service に対してノード起動時に sctp カーネルモジュールを読み込むよう指示します。

$ cat os-files/etc/modules-load.d/sctp.conf
# Request "systemd-modules-load.service" to load sctp module at boot time
sctp

50.2.7.2 vfio-pci.conf

os-files/etc/modules-load.d/ パスに配置し、 systemd-modules-load.service に対してノード起動時に vfio-pci カーネルモジュールを読み込むよう指示します。

$ cat os-files/etc/modules-load.d/vfio-pci.conf
# Request "systemd-modules-load.service" to load vfio-pci module at boot time
# NOTE: The (SRIOV & DPDK related) required load-module options settings are defined in related "/etc/modprobe.d/vfio-pci-options.conf" file
vfio_pci

50.2.7.3 vfio-pci-options.conf

os-files/etc/modprobe.d/ パスに配置し、カーネルモジュールの読み込み時に適用される必要な vfio-pci カーネルモジュールパラメーターを設定します。

$ cat os-files/etc/modprobe.d/vfio-pci-options.conf
# Enable SR-IOV and disable idle D3 state for vfio-pci driver
options vfio_pci enable_sriov=1 disable_idle_d3=1

50.3 イメージの作成

前のセクションに従ってディレクトリ構造が準備できたら、次のコマンドを実行してイメージをビルドします。

podman run --rm --privileged -it -v $PWD:/eib \
 registry.suse.com/edge/3.7/edge-image-builder:1.3.4 \
 build --definition-file downstream-cluster-config.yaml

これにより、上記で説明した定義に基づいて、`eibimage-output-telco.raw`という名前の出力RAWイメージファイルが作成されます。

出力されたイメージは、Management Cluster Documentation (注記)で有効化されたメディアサーバーコンテナ、またはローカルでアクセス可能なその他のサーバーなど、Webサーバー経由で利用できるようにする必要があります。 以下の例では、このサーバーを imagecache.local:8080 と呼びます。