• 请不要在回答技术问题时复制粘贴 AI 生成的内容
leiuu
V2EX  ›  程序员

k8s pod 可以作为固定的 jenkins agent 吗

  •  
  •   leiuu · May 24, 2022 · 2201 views
    This topic created in 1451 days ago, the information mentioned may be changed or developed.
    Supplement 1  ·  May 25, 2022
    其实是想了解 jenkins on k8s 的话,大家的最佳实践一般是怎样的。
    例如:
    1. 基于 k8s 插件动态创建 agent pod ,但如何解决缓存问题
    2. 基于 k8s 插件创建静态 agent ,但需要考虑 jenkins slave 、master 联通以及多 container 如何切换等问题
    11 replies    2022-05-25 15:27:30 +08:00
    leiuu
        1
    leiuu  
    OP
       May 24, 2022
    k8s pod 作为动态的 agent 是可以的。但考虑 git 代码缓存、maven cache 等如果能作为静态 agent 使用似乎更方便。
    julyclyde
        2
    julyclyde  
       May 24, 2022
    用 volume 做 cache 吧
    pod 可以随用随销毁
    a663
        3
    a663  
       May 24, 2022
    给动态 agent 挂 pvc ,缓存设置在 pvc 路径内
    leiuu
        4
    leiuu  
    OP
       May 24, 2022
    @julyclyde
    @a663
    这个思路看着可以。👍
    有一个细节,考虑多个 agent 的话。maven cache 、git cache pv ( ReadWriteMany )如果有多个 agent 并发读写不知道会怎么样?
    或者说是 agent 之间不建议做共享。
    Tinet
        5
    Tinet  
       May 24, 2022
    agent 之间不建议做共享,会有坑
    YzSama
        6
    YzSama  
       May 24, 2022
    你直接创建一个 static pod 不就好了。
    myki
        7
    myki  
       May 24, 2022
    楼上正解
    leiuu
        8
    leiuu  
    OP
       May 24, 2022
    @YzSama 静态的话 jenkins 怎么和 static pod 通信呢。
    YzSama
        9
    YzSama  
       May 25, 2022
    @leiuu #8 不是用 k8s 么,集群内部都是可以通讯的啊。static pod 也是 k8s 的资源,要服务发现就加一个 svc + ep
    julyclyde
        10
    julyclyde  
       May 25, 2022
    @leiuu 这事和容器没什么关系。你就算在本地同时执行多个同样的访问 cache 的程序,也会遇到相同的问题
    leiuu
        11
    leiuu  
    OP
       May 25, 2022
    @julyclyde 谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3232 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 59ms · UTC 13:25 · PVG 21:25 · LAX 06:25 · JFK 09:25
    ♥ Do have faith in what you're doing.