4.7. ビルド済みのドライバーコンテナーに署名する

ハードウェアベンダーによって配布されたイメージや別の場所でビルドされたイメージなど、ビルド済みのイメージがある場合は、この手順を使用します。

次の YAML ファイルは、公開鍵と秘密鍵のペアを必要なキー名 (秘密鍵の場合は key、公開鍵の場合は cert) を持つシークレットとして追加します。次に、クラスターは unsignedImage イメージをプルダウンし、これを開いて filesToSign に一覧表示されているカーネルモジュールに署名し、それらを再び追加し、作成されたイメージを containerImage としてプッシュします。

Kernel Module Management (KMM) は、セレクターに一致するすべてのノードに署名済みの kmod をロードする DaemonSet をデプロイする必要があります。ドライバーコンテナーは、MOK データベースに公開鍵があるすべてのノード、および署名を無視するセキュアブートが有効になっていないすべてのノードで正常に実行されるはずです。セキュアブートが有効になっているが、MOK データベースにそのキーがない場合は、ロードに失敗するはずです。

前提条件

  • keySecret および certSecret シークレットが作成されている。

手順

  1. YAML ファイルを適用します。

    ---
    apiVersion: kmm.sigs.x-k8s.io/v1beta1
    kind: Module
    metadata:
      name: example-module
    spec:
      moduleLoader:
        serviceAccountName: default
        container:
          modprobe: 1
            moduleName: '<your module name>'
          kernelMappings:
            # the kmods will be deployed on all nodes in the cluster with a kernel that matches the regexp
            - regexp: '^.*\.x86_64$'
              # the container to produce containing the signed kmods
              containerImage: <image name e.g. quay.io/myuser/my-driver:<kernelversion>-signed>
              sign:
                # the image containing the unsigned kmods (we need this because we are not building the kmods within the cluster)
                unsignedImage: <image name e.g. quay.io/myuser/my-driver:<kernelversion> >
                keySecret: # a secret holding the private secureboot key with the key 'key'
                  name: <private key secret name>
                certSecret: # a secret holding the public secureboot key with the key 'cert'
                  name: <certificate secret name>
                filesToSign: # full path within the unsignedImage container to the kmod(s) to sign
                  - /opt/lib/modules/4.18.0-348.2.1.el8_5.x86_64/kmm_ci_a.ko
      imageRepoSecret:
        # the name of a secret containing credentials to pull unsignedImage and push containerImage to the registry
        name: repo-pull-secret
      selector:
        kubernetes.io/arch: amd64
1
modprobe - ロードする kmod の名前。