Kanade 我使用Devops构建,将containerCapStr改成了10,准备了2个ci节点,然后同时启动了10个流水线构建。 然后在容器组中查看kubesphere-devops-worker项目下的容器,发现所有构建用的容器都被调度到了同一个ci节点上,导致这个节点cpu内存消耗达到了99%,另一个节点却一个任务都没有。 然后我将负载过高的ci节点停止调度,另一个ci节点这才有任务分配到上面。 请问怎么配置,才能让系统将构建任务均匀分配到各个ci节点?
yudong Kanade ks-devops 对 jenkins slave(容器) 的调度没有做现在;这个应该可能跟当前 k8s 环境资源及配置有关系,可以查询下网络上 ”k8s 资源倾斜“ 相关的资料。
Kanade rufei 在配置、配置字典中搜索 jenkins-casc-config,然后修改 jenkins_user.yaml 中的 containerCapStr 就行,这个是控制jenkins同时启动的容器数量的
Kanade 我已经找到方法了,可以修改 jenkins-casc-config 中,podtemplate的yaml模板,添加pod互斥性配置,就可以让pod分配到不同节点。以下是我自己配置的podtemplate,可供参考 - name: "android" label: "android" inheritFrom: "base" nodeUsageMode: "EXCLUSIVE" containers: - name: "android" image: "docker.hub.configure.ottcn.com/devops/android-31:latest" command: "cat" args: "" ttyEnabled: true privileged: false resourceRequestCpu: "100m" resourceLimitCpu: "4000m" resourceRequestMemory: "100Mi" resourceLimitMemory: "8192Mi" envVars: - envVar: key: "LC_ALL" value: "C.UTF-8" - envVar: key: "LANG" value: "C.UTF-8" volumes: - hostPathVolume: hostPath: "/data/ci-cache/gradle-cache" mountPath: "/data/ci-cache/gradle-cache" - hostPathVolume: hostPath: "/data/ci-tools/gradle" mountPath: "/data/ci-tools/gradle" - hostPathVolume: hostPath: "/data/ci-cache/android-cache" mountPath: "/data/ci-cache/android-cache" - hostPathVolume: hostPath: "/data/ci-tools/android/build-tools" mountPath: "/opt/android-sdk-linux/build-tools" - hostPathVolume: hostPath: "/data/ci-tools/android/platforms" mountPath: "/opt/android-sdk-linux/platforms" - hostPathVolume: hostPath: "/data/ci-cache/sonar-cache" mountPath: "/root/.sonar/cache" yaml: | spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: node-role.kubernetes.io/worker operator: In values: - ci podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 1 podAffinityTerm: labelSelector: matchExpressions: - key: jenkins/label operator: In values: - android topologyKey: kubernetes.io/hostname tolerations: - key: "node.kubernetes.io/ci" operator: "Exists" effect: "NoSchedule" - key: "node.kubernetes.io/ci" operator: "Exists" effect: "PreferNoSchedule" containers: - name: "android" resources: requests: ephemeral-storage: "1Gi" limits: ephemeral-storage: "10Gi" securityContext: fsGroup: 1000