添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
健身的键盘  ·  Python Docker IMAGE 的挑选·  2 周前    · 
从未表白的骆驼  ·  Build ffmpeg for ...·  2 月前    · 
刚毅的围巾  ·  What is commit hash ...·  5 月前    · 
彷徨的马铃薯  ·  linux命令grep参数 • ...·  6 月前    · 
俊秀的盒饭  ·  8.2.1.16 ORDER BY ...·  6 月前    · 
搜索

4.8. 构建并签署 ModuleLoader 容器镜像

download PDF

如果您有源代码且必须首先构建镜像,请使用这个流程。 以下 YAML 文件使用存储库中的源代码构建新容器镜像。生成的镜像将保存到带有临时名称的 registry 中,然后使用 sign 部分中的参数来签名此临时镜像。 临时镜像名称基于最终镜像名称,设置为 <containerImage>:<tag>-<namespace>_<module name>_kmm_unsigned 。 例如,使用以下 YAML 文件,内核模块管理 (KMM) 构建一个名为 example.org/repository/minimal-driver:final-default_example-module_kmm_unsigned 的镜像,其中包含带有未签名的 kmods 的构建并将其推送到 registry。然后,它创建一个名为 example.org/repository/minimal-driver:final 的第二个镜像,其中包含签名的 kmod。它是 DaemonSet 对象载入的第二个镜像,并将 kmods 部署到集群节点。 签名后,可以从 registry 中安全地删除临时镜像。如果需要,它将被重建。 keySecret certSecret secret 已创建。 应用 YAML 文件: apiVersion: v1 kind: ConfigMap metadata: name: example-module-dockerfile namespace: default 1 data: Dockerfile: | ARG DTK_AUTO ARG KERNEL_VERSION FROM ${DTK_AUTO} as builder WORKDIR /build/ RUN git clone -b main --single-branch https://github.com/rh-ecosystem-edge/kernel-module-management.git WORKDIR kernel-module-management/ci/kmm-kmod/ RUN make FROM registry.access.redhat.com/ubi8/ubi:latest ARG KERNEL_VERSION RUN yum -y install kmod && yum clean all RUN mkdir -p /opt/lib/modules/${KERNEL_VERSION} COPY --from=builder /build/kernel-module-management/ci/kmm-kmod/*.ko /opt/lib/modules/${KERNEL_VERSION}/ RUN /usr/sbin/depmod -b /opt apiVersion: kmm.sigs.x-k8s.io/v1beta1 kind: Module metadata: name: example-module namespace: default 2 spec: moduleLoader: serviceAccountName: default 3 container: modprobe: moduleName: simple_kmod kernelMappings: - regexp: '^.*\.x86_64$' containerImage: < the name of the final driver container to produce> build: dockerfileConfigMap: name: example-module-dockerfile sign: keySecret: name: <private key secret name> certSecret: name: <certificate secret name> filesToSign: - /opt/lib/modules/4.18.0-348.2.1.el8_5.x86_64/kmm_ci_a.ko imageRepoSecret: 4 name: repo-pull-secret selector: # top-level selector kubernetes.io/arch: amd64

1 2
namespace - 使用有效的命名空间替换 default serviceAccountName - 默认 serviceAccountName 没有运行特权的模块所需的权限。有关创建服务帐户的详情,请参考本节的"添加资源"中的"创建服务帐户"。