4.7. Signer un conteneur de pilote préconstruit
Utilisez cette procédure si vous disposez d'une image préconstruite, telle qu'une image distribuée par un fournisseur de matériel ou construite ailleurs.
Le fichier YAML suivant ajoute la paire de clés publique/privée en tant que secrets avec les noms de clés requis - key
pour la clé privée, cert
pour la clé publique. Le cluster extrait ensuite l'image unsignedImage
, l'ouvre, signe les modules du noyau répertoriés dans filesToSign
, les réintègre et pousse l'image résultante sous containerImage
.
Kernel Module Management (KMM) devrait alors déployer le DaemonSet qui charge les kmods signés sur tous les nœuds qui correspondent au sélecteur. Les conteneurs de pilotes doivent s'exécuter avec succès sur tous les nœuds dont la base de données MOK contient la clé publique, ainsi que sur tous les nœuds dont le démarrage sécurisé n'est pas activé, qui ignorent la signature. Ils ne doivent pas se charger sur les nœuds dont le démarrage sécurisé est activé, mais dont la base de données MOK ne contient pas la clé.
Conditions préalables
-
Les secrets
keySecret
etcertSecret
ont été créés.
Procédure
Appliquer le fichier YAML :
Copy to Clipboard Copied! Toggle word wrap Toggle overflow --- apiVersion: kmm.sigs.x-k8s.io/v1beta1 kind: Module metadata: name: example-module spec: moduleLoader: serviceAccountName: default container: modprobe: 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
--- 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
- Le nom du kmod à charger.