4.2. Image Mode for RHEL への移行時に UID と GID のドリフトを回避する
MicroShift を実行しているオペレーティングシステムを再インストールしない場合は、移行プロセス中に発生する可能性のある UID および GID のドリフトを回避する必要があります。この問題を解決する 1 つの方法は、影響を受けるシステムサービスが開始される前に、必要な修正を適用する systemd ユニットを追加することです。
前提条件
- MicroShift を実行している既存の RHEL for Edge デプロイメントがある。
- ビルドホストへのルートアクセス権がある。
- デプロイしたいイメージがある。
手順
MicroShift イメージビルドの手順に次のコマンドを追加して、Open vSwitch (OVS)
systemdサービス、ovsdb-server.serviceの潜在的な UID または GID ドリフトを解決します。# Install systemd configuration drop-ins to fix potential permission problems when upgrading from rpm-ostree commits to image mode container layers RUN mkdir -p /usr/lib/systemd/system/ovsdb-server.service.d && \ cat > /usr/lib/systemd/system/ovsdb-server.service.d/microshift-ovsdb-ownership.conf <<'EOF' # The openvswitch database files must be owned by the appropriate user and its primary group. That the user and its group can be overwritten, recreate them. [Service] ExecStartPre=/bin/sh -c '/bin/getent passwd openvswitch >/dev/null || useradd -r openvswitch' ExecStartPre=/bin/sh -c '/bin/getent group hugetlbfs >/dev/null || groupadd -r hugetlbfs' ExecStartPre=/sbin/usermod -a -G hugetlbfs openvswitch ExecStartPre=/bin/chown -Rhv openvswitch. /etc/openvswitch EOF
重要
Image Mode for RHEL への MicroShift の移行が完了すると、この回避策は必要なくなり、削除できます。