在jenkins中未找到容器

d5vmydt9  于 12个月前  发布在  Jenkins
关注(0)|答案(1)|浏览(130)

我们正在运行一个带有声明性管道的jenkins管道。其中一个代理容器使用了太多的临时存储,所以我们想到向容器添加一个持久卷来解决这个问题。
我们添加了一个workspaceVolume,但现在它得到了一个不同的错误:
hudson.remoting.ProxyException:io.fabric8.kubernetes.client.KubernetesClientException:在位于io.fabric8.kubernetes.client.dsl.internal.core.v1.PodOperationsImpl.validateOrDefaultContainerId(PodOperationsImpl.java:344)的Pod中未找到容器 Flutter
我也不知道是什么原因造成的。跟踪pod日志显示jnlp容器在pod上创建,然后突然出错,无法看到其间发生了什么。
我可以看到动态PVC正在创建并分配给pod,之后可以看到jnlp,然后是错误。
描述PVC显示:

Successfully provisioned volume ocid1.volume.oc1.region.abvgkljrua6fyyqikxedgj337hzv7xkjybnenthp72cpfoyvf5r742sd3w4q

活动展示:

21m         Warning   FailedScheduling         pod/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj                                                            0/6 nodes are available: 6 persistentvolumeclaim "pvc-workspace-fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj" not found. preemption: 0/6 nodes are available: 6 Preemption is not helpful for scheduling.
21m         Warning   FailedScheduling         pod/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj                                                            0/6 nodes are available: 6 pod has unbound immediate PersistentVolumeClaims. preemption: 0/6 nodes are available: 6 Preemption is not helpful for scheduling.
21m         Normal    Scheduled                pod/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj                                                            Successfully assigned default/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj to 10.0.10.223
21m         Normal    SuccessfulAttachVolume   pod/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj                                                            AttachVolume.Attach succeeded for volume "ocid1.volume.oc1.region.abvgkljrfwf3fknno2yz4776oachzlewpbzajjz4whjaw5wlthheg3kifmiq"
20m         Normal    Pulled                   pod/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj                                                            Container image "jenkins/inbound-agent:3107.v665000b_51092-4" already present on machine
20m         Normal    Created                  pod/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj                                                            Created container jnlp
20m         Normal    Started                  pod/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj                                                            Started container jnlp
20m         Normal    Killing                  pod/fluttered-mobile-android-46-7s3mb-sq4b5-1bbxj                                                            Stopping container jnlp
20m         Warning   VolumeFailedDelete       persistentvolume/ocid1.volume.oc1.region.abvgkljrfwf3fknno2yz4776oachzlewpbzajjz4whjaw5wlthheg3kifmiq   failed to delete volume from OCI: Error returned by Blockstorage Service. Http Status Code: 409. Error Code: Conflict. Opc request id: 76ecc82dad7a3241de2a70fbc91895c8/0916D58101760EDEDB599936BABBF1D9/39E5A4B955F935D7253BB1AC197BEFDD. Message: Volume ocid1.volume.oc1.region.abvgkljrfwf3fknno2yz4776oachzlewpbzajjz4whjaw5wlthheg3kifmiq may not be deleted while attached to an Instance.....

PVC需要一些时间来连接,然后它启动jnlp容器,然后停止jnlp容器。还存在无法删除PVC卷的错误。
我尝试使用-p获取关闭的jnlp日志,但这是不可能的(我已经为crashloopbackoff容器这样做了)
下面是管道中的代理配置:

agent {
        kubernetes {
            workspaceVolume dynamicPVC(accessModes: 'ReadWriteOnce', requestsSize: "100Gi", storageClassName: "oci")
            yaml '''
          apiVersion: v1
          kind: Pod
          spec:
            securityContext:
              fsGroup: 1000
              runAsGroup: 1000
              runAsUser: 1000
          containers:
          - name: ubuntu
            image: ubuntu:latest
            command:
            - cat
            tty: true
          - name: git
            image: git:latest
            command:
            - cat
            tty: true
          - name: curl
            image:alpine-curl-jq:latest
            command:
            - cat
            tty: true
          - name: flutter
            image: flutter_image:2.10.1
            command:
            - cat
            tty: true
          - name: build
            image: flutter_image:2.10.1
            command:
            - cat
            tty: true
          imagePullSecrets:
          - name: ocirsecret
        '''
    }
  }
x4shl7ld

x4shl7ld1#

您的YAML格式不正确。这些集装箱必须符合规格

agent {
    kubernetes {
        workspaceVolume dynamicPVC(accessModes: 'ReadWriteOnce', requestsSize: "100Gi", storageClassName: "oci")
        yaml '''
      apiVersion: v1
      kind: Pod
      spec:
        securityContext:
          fsGroup: 1000
          runAsGroup: 1000
          runAsUser: 1000
        containers:
        - name: ubuntu
          image: ubuntu:latest
          command:
          - cat
          tty: true
        - name: git
          image: git:latest
          command:
          - cat
          tty: true
        - name: curl
          image:alpine-curl-jq:latest
          command:
          - cat
          tty: true
        - name: flutter
          image: flutter_image:2.10.1
          command:
          - cat
          tty: true
        - name: build
          image: flutter_image:2.10.1
          command:
          - cat
          tty: true
        imagePullSecrets:
        - name: ocirsecret
    '''
}

}

相关问题