Vraw5

各位是如何在 k8s 中做镜像构建的?

  •  
  •   Vraw5 · Jun 17, 2025 · 4542 views
    This topic created in 514 days ago, the information mentioned may be changed or developed.
    集群里有两台机器用作 jenkins kubernetes agent 做 CICD ,以前 k8s 在 1.24 以下时主机使用 docker engine ,我可以通过挂载 docker.sock 直接使用主机的 docker 做镜像,后来 k8s 升级后使用 kaniko 构建镜像,昨天看 kaniko 的 github 已经在两周前归档了,想换掉它,有没有 kaniko 的替代品。
    12 replies  •  2025-06-18 08:11:34 +08:00
    beyondstars
    beyondstars
    Jun 17, 2025
    1
    lomtom
    lomtom
    Jun 17, 2025
    2
    @beyondstars 之前写过关于 buildkit 的使用,这个确实可以,可以参考一下 https://lomtom.cn/vrqlkpdd61y0
    justdoit123
    justdoit123
    Jun 17, 2025
    3
    什么? kaniko 这玩意归档了啊?

    https://github.com/GoogleContainerTools/kaniko/issues/3348#issuecomment-2935160773

    > This was never an official Google product. This is dead, time to move to buildkit or buildah.

    坐等一个替代品建议。求有用过大佬分享一下替代品的使用体验。
    anubu
    anubu
    Jun 17, 2025
    4
    变更最小的就是 dind ,以 ds 部署 docker ,然后挂载 docker.sock ,和原流程几乎没有变化。从挂载宿主机 sock 到 ds 容器的 sock ,可能要再调试认证、缓存、性能等问题。
    shakaraka
    shakaraka
    Jun 17, 2025
    5
    我也在看在没有 docker 的情况下如何打包构建镜像,也是看到 kaniko 和 buildah 两个
    DreamSpace
    DreamSpace
    Jun 17, 2025
    6
    https://tekton.dev/
    我用 Tekton+K3S 做的 CI ,体验尚可,这个比较适合包装一下做成 CI/CD 平台
    DreamSpace
    DreamSpace
    Jun 17, 2025
    7
    不好意思没看清题目,我也用的 tekton 打包,竟然已经归档了
    Vraw5
    Vraw5
    OP
    Jun 17, 2025
    8
    kaniko 在 Readme 中有提到几个其他工具,可以参考。
    https://github.com/GoogleContainerTools/kaniko?tab=readme-ov-file#comparison-with-other-tools

    @wunonglin #5 或许 BuildKit 是最优解。img 已经停更很多年,Buildah 可能需要手动制作一个镜像,我没有找到官方镜像。Bazel rules_docker 不支持 RUN
    Rat3
    Rat3
    Jun 17, 2025
    9
    dind + buildkit
    Bromine0x23
    Bromine0x23
    Jun 17, 2025
    10
    buildah 的官方镜像是 `quay.io/buildah/stable` 这个?但是这个好像不会合并 ARG 和 ENV 之类的空层。

    buildkit 用 rootless 我这 air-gap 环境搞不定 FROM 的证书校验问题。
    Vraw5
    Vraw5
    OP
    Jun 17, 2025
    11
    @Bromine0x23 #10 镜像好像是官方的。明天把 buildah 和 buildkit 都试用试试。

    我看 buildkit 可以做 server-client 模式,是不是可以一直起着一个 Deployment ,做 CI 的时候直接指定 buildctl --addr kube-pod://buildkitd ,就是不清楚 server 能不能同时让多个 client 使用
    feifeizhou
    feifeizhou
    Jun 18, 2025 via Android
    12
    我用 podman
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   937 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 20:04 · PVG 04:04 · LAX 12:04 · JFK 15:04
    ♥ Do have faith in what you're doing.