问题描述
我在 K8S 上使用 Jenkins。
突然我的一个容器在 Jenkinsfile 中出现故障,昨天一切正常,但突然出现故障
编辑:我已将官方 curl 图像上传到私人存储库
podTemplate(
containers: [
containerTemplate(name: 'helm',alwaysPullImage: true,image: 'private-repo.com:8023/lachlanevenson/k8s-helm:v3.4.2',command: 'cat',ttyEnabled: true),containerTemplate(name: 'curl',image: 'private-repo.com:8023/curlimages/curl',ttyEnabled: true)
],imagePullSecrets: ['registry-credentials']) {
properties([parameters(
[string(name: 'dockerImageTag',description: 'Docker image tag to deploy'),string(name: 'branchName',defaultValue: 'dev',description: 'Branch being deployed'),string(name: 'targetBranch',description: 'Target branch against which if a PR is being raised')])])
currentBuild.description = "branch ${params.branchName}"
node(POD_LABEL) {
container('helm') {
//code here working fine
}
container('curl') {
stage('Refresh Gateway routes') {
sh script: 'curl -X POST \\\n' +
' http://my-server.com/actuator/gateway/refresh \\\n' +
' -H \'Accept: application/json\' \\\n' +
' -H \'Host: my-server.com\' \\\n' +
' -H \'cache-control: no-cache\'',label: 'Force refresh routes cache'
}
}
}
}
所以我的第二个容器只有 curl 命令并且它工作正常,但突然它给了我如下错误
sh: can't create /home/jenkins/agent/workspace/sling-sales/sd-config/deploy-to-qa@tmp/durable-4549c114/jenkins-log.txt: Permission denied
sh: can't create /home/jenkins/agent/workspace/sling-sales/sd-config/deploy-to-qa@tmp/durable-4549c114/jenkins-result.txt.tmp: Permission denied
mv: can't rename '/home/jenkins/agent/workspace/sling-sales/sd-config/deploy-to-qa@tmp/durable-4549c114/jenkins-result.txt.tmp': No such file or directory
touch: /home/jenkins/agent/workspace/sling-sales/sd-config/deploy-to-qa@tmp/durable-4549c114/jenkins-log.txt: Permission denied
touch: /home/jenkins/agent/workspace/sling-sales/sd-config/deploy-to-qa@tmp/durable-4549c114/jenkins-log.txt: Permission denied
当我检查正在运行的 pod 时,我得到了一些详细信息,如下所示
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
normal Scheduled 4m56s default-scheduler Successfully assigned default/sling-sales-sd-config-deploy-to-qa-3-rksjh-mt0js-f3tk8 to sd-jenkins-cluster-node-g7ow
normal Pulling 4m54s kubelet,sd-jenkins-cluster-node-g7ow Pulling image "private-repo.com:8023/sling/jenkins/curl"
normal Pulled 4m54s kubelet,sd-jenkins-cluster-node-g7ow Successfully pulled image "private-repo.com:8023/sling/jenkins/curl"
normal Created 4m54s kubelet,sd-jenkins-cluster-node-g7ow Created container curl
normal Started 4m54s kubelet,sd-jenkins-cluster-node-g7ow Started container curl
normal Pulling 4m54s kubelet,sd-jenkins-cluster-node-g7ow Pulling image "private-repo.com:8023/lachlanevenson/k8s-helm:v3.4.2"
normal Pulled 4m54s kubelet,sd-jenkins-cluster-node-g7ow Successfully pulled image "private-repo.com:8023/lachlanevenson/k8s-helm:v3.4.2"
normal Created 4m54s kubelet,sd-jenkins-cluster-node-g7ow Created container helm
normal Started 4m54s kubelet,sd-jenkins-cluster-node-g7ow Started container helm
normal Pulled 4m54s kubelet,sd-jenkins-cluster-node-g7ow Container image "jenkins/inbound-agent:4.3-4" already present on machine
normal Created 4m54s kubelet,sd-jenkins-cluster-node-g7ow Created container jnlp
normal Started 4m54s kubelet,sd-jenkins-cluster-node-g7ow Started container jnlp
运行jenkins pod的日志如下
Jan 13,2021 2:19:57 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: sling-sales-sd-config-deploy-to-qa-3-rksjh-mt0js-f3tk8
Jan 13,2021 2:19:57 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Jan 13,2021 2:19:57 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.3
Jan 13,2021 2:19:57 PM org.jenkinsci.remoting.engine.workdirManager initializeworkdir
INFO: Using /home/jenkins/agent/remoting as a remoting work directory
Jan 13,2021 2:19:57 PM org.jenkinsci.remoting.engine.workdirManager setupLogging
INFO: Both error and output logs will be printed to /home/jenkins/agent/remoting
Jan 13,2021 2:19:57 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://jenkins.sling-dev.com:8080/]
Jan 13,2021 2:19:57 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect,Ping]
Jan 13,2021 2:19:57 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting TCP connection tunneling is enabled. Skipping the TCP Agent Listener Port availability check
Jan 13,2021 2:19:57 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
Agent address: jenkins-master-agent
Agent port: 50000
Identity: 50:64:22:83:23:d1:5b:25:da:01:51:0e:7d:c8:8a:a9
Jan 13,2021 2:19:57 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Jan 13,2021 2:19:57 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to jenkins-master-agent:50000
Jan 13,2021 2:19:57 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
Jan 13,2021 2:19:57 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Remote identity confirmed: 50:64:22:83:23:d1:5b:25:da:01:51:0e:7d:c8:8a:a9
Jan 13,2021 2:19:58 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected
有人可以帮我解决这个问题吗?
谢谢 阿尔卑斯
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)