按官方文档

https://kubesphere.com.cn/docs/devops-user-guide/how-to-use/create-a-pipeline-using-graphical-editing-panel/

构建了一个流水线,无法正常启动

报错如下:

对应的 maven 容器 已经拉起来了

请大神些解决下

  • 该问题已解决,原因是内置 pod template 里的镜像有问题

    以 go 环境为例

    将原来的 kubesphere/builder-go:v3.1.0 换成 kubesphere/builder-go:v2.1.0 就一切工作正常了

5 天 后

johnniang

pipeline {
agent {
node {
label ‘base’
}

}
stages {
stage(‘stage-w4jl7’) {
agent none
steps {
sh ‘echo “this is test”’
}
}

}

现在将流水线改成最简单的了 还是报错

从报错看是 jenkins agent 连不上

但对应的 pod 是启动了的

应该还是节点 没启动起来 是什么原因呢?

看容器里的日志 jenkins agents 是连上了的

但jenkins 页面上又是报错的

而且容器里连的地址好像和 jenkins 页面上的并不一样?

    该问题已解决,原因是内置 pod template 里的镜像有问题

    以 go 环境为例

    将原来的 kubesphere/builder-go:v3.1.0 换成 kubesphere/builder-go:v2.1.0 就一切工作正常了

    该问题已解决,原因是内置 pod template 里的镜像有问题。以 go 环境为例
    我刚刚测试,builder-go:v3.1.0这个镜像是没问题的,请看下面的测试过程:

    下面是测试流水线:

    pipeline {
        agent {
         label 'go'
        
        }
        stages {
            stage('ss') {
                steps {
                    container('go') {
                        sh 'go version'
                    }
                }
            }
        
        }
    }

    下面是测试的输出日志:

    Started by user admin
    Running in Durability level: MAX_SURVIVABILITY
    [Pipeline] Start of Pipeline
    [Pipeline] node
    Agent go-j8gf2 is provisioned from template go
    ---
    apiVersion: "v1"
    kind: "Pod"
    metadata:
      annotations: {}
      labels:
        jenkins: "slave"
        jenkins/label-digest: "e84a3b2cb16af20654b162562a7360c9fc00fd54"
        jenkins/label: "go"
      name: "go-j8gf2"
    spec:
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - preference:
              matchExpressions:
              - key: "node-role.kubernetes.io/worker"
                operator: "In"
                values:
                - "ci"
            weight: 1
      containers:
      - command:
        - "cat"
        image: "kubesphere/builder-go:v3.1.0"
        imagePullPolicy: "IfNotPresent"
        name: "go"
        resources:
          limits:
            ephemeral-storage: "10Gi"
            memory: "8192Mi"
            cpu: "4000m"
          requests:
            ephemeral-storage: "1Gi"
            memory: "100Mi"
            cpu: "100m"
        tty: true
        volumeMounts:
        - mountPath: "/home/jenkins/agent"
          name: "workspace-volume"
          readOnly: false
        - mountPath: "/root/.sonar/cache"
          name: "volume-2"
          readOnly: false
        - mountPath: "/var/run/docker.sock"
          name: "volume-0"
          readOnly: false
        - mountPath: "/home/jenkins/go/pkg"
          name: "volume-1"
          readOnly: false
        workingDir: "/home/jenkins/agent"
      - args:
        - "********"
        - "go-j8gf2"
        command:
        - "jenkins-slave"
        env:
        - name: "JENKINS_SECRET"
          value: "********"
        - name: "JENKINS_TUNNEL"
          value: "ks-jenkins-agent.kubesphere-devops-system:50000"
        - name: "JENKINS_AGENT_NAME"
          value: "go-j8gf2"
        - name: "JENKINS_NAME"
          value: "go-j8gf2"
        - name: "JENKINS_AGENT_WORKDIR"
          value: "/home/jenkins/agent"
        - name: "JENKINS_URL"
          value: "http://ks-jenkins.kubesphere-devops-system:80/"
        image: "registry.cn-beijing.aliyuncs.com/kubesphereio/jnlp-slave:3.27-1"
        imagePullPolicy: "IfNotPresent"
        name: "jnlp"
        resources:
          limits:
            memory: "1536Mi"
          requests:
            memory: "400Mi"
            cpu: "50m"
        tty: false
        volumeMounts:
        - mountPath: "/root/.sonar/cache"
          name: "volume-2"
          readOnly: false
        - mountPath: "/var/run/docker.sock"
          name: "volume-0"
          readOnly: false
        - mountPath: "/home/jenkins/go/pkg"
          name: "volume-1"
          readOnly: false
        - mountPath: "/home/jenkins/agent"
          name: "workspace-volume"
          readOnly: false
        workingDir: "/home/jenkins/agent"
      hostNetwork: false
      nodeSelector: {}
      restartPolicy: "Never"
      securityContext:
        fsGroup: 1000
      tolerations:
      - effect: "NoSchedule"
        key: "node.kubernetes.io/ci"
        operator: "Exists"
      - effect: "PreferNoSchedule"
        key: "node.kubernetes.io/ci"
        operator: "Exists"
      volumes:
      - hostPath:
          path: "/var/run/docker.sock"
        name: "volume-0"
      - hostPath:
          path: "/var/data/jenkins_sonar_cache"
        name: "volume-2"
      - hostPath:
          path: "/var/data/jenkins_go_cache"
        name: "volume-1"
      - emptyDir:
          medium: ""
        name: "workspace-volume"
    
    Running on go-j8gf2 in /home/jenkins/agent/workspace/demo
    [Pipeline] {
    [Pipeline] stage
    [Pipeline] { (ss)
    [Pipeline] container
    [Pipeline] {
    [Pipeline] sh
    + go version
    go version go1.12.10 linux/amd64
    [Pipeline] }
    [Pipeline] // container
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] }
    [Pipeline] // node
    [Pipeline] End of Pipeline
    Finished: SUCCESS
    • Mike 回复了此帖

      Rick 我用你方法 测试了下 3.10 的镜像问题依旧

      换 2.1.0 后 就可以了

      下面是我的镜像的详细信息,帮忙提供下你那边的:

      [root@i-q73jfmqj ~]# docker pull kubesphere/builder-go:v3.1.0
      v3.1.0: Pulling from kubesphere/builder-go
      Digest: sha256:5b017039ba045c9d30904e97e65fed1239b3e87fb8519e383a25faa42bc2fd9c
      Status: Image is up to date for kubesphere/builder-go:v3.1.0
      docker.io/kubesphere/builder-go:v3.1.0

      最最最后的结论:根本原因还是官方这个3.1 的镜像太大了 1.43 G 节点还没下载完引起的 手动提前在节点上下载好镜像
      就可以了