gpt4 book ai didi

jenkins kubernetes 插件在循环中运行 Pod,并且永远不会构建作业

转载 作者:行者123 更新时间:2023-12-02 11:46:28 27 4
gpt4 key购买 nike

我正在使用 jenkins kubernetes 插件。配置它并测试如下示例管道代码:

podTemplate(containers: [
containerTemplate(name: 'ssh-client', image: 'kroniak/ssh-client:3.6', ttyEnabled: true, command: 'cat')
]) {
node(POD_LABEL) {
stage('container log') {
container('ssh-client') {
sshagent (credentials: ['ContainerExecDecoratorPipelineTest-sshagent']) {
sh 'env'
sh 'ssh-add -L'
sh 'ssh -vT -o "StrictHostKeyChecking=no" git@github.com'
}
}
}
}
}
在构建过程中,我可以检查我的 kubernetes 集群并注意到 pod 正在创建但也在几秒钟后终止。它不断地无限发生。我什至检查了所有其他示例管道。 Jenkins 中的控制台输出显示:
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Created Pod: ns-jenkins/tests-14-zm889-hxd6p-j19bl
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Scheduled] Successfully assigned ns-jenkins/tests-14-zm889-hxd6p-j19bl to docker-desktop
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Pulling] Pulling image "kroniak/ssh-client:3.6"
Still waiting to schedule task
‘tests-14-zm889-hxd6p-j19bl’ is offline
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Pulled] Successfully pulled image "kroniak/ssh-client:3.6"
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Created] Created container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Started] Started container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Pulled] Container image "jenkins/inbound-agent:4.3-4" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Created] Created container jnlp
[Normal][ns-jenkins/tests-14-zm889-hxd6p-j19bl][Started] Started container jnlp
Created Pod: ns-jenkins/tests-14-zm889-hxd6p-23hwk
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Scheduled] Successfully assigned ns-jenkins/tests-14-zm889-hxd6p-23hwk to docker-desktop
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Pulled] Container image "kroniak/ssh-client:3.6" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Created] Created container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Started] Started container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Pulled] Container image "jenkins/inbound-agent:4.3-4" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Created] Created container jnlp
[Normal][ns-jenkins/tests-14-zm889-hxd6p-23hwk][Started] Started container jnlp
Created Pod: ns-jenkins/tests-14-zm889-hxd6p-wnxr9
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Scheduled] Successfully assigned ns-jenkins/tests-14-zm889-hxd6p-wnxr9 to docker-desktop
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Pulled] Container image "kroniak/ssh-client:3.6" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Created] Created container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Started] Started container ssh-client
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Pulled] Container image "jenkins/inbound-agent:4.3-4" already present on machine
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Created] Created container jnlp
[Normal][ns-jenkins/tests-14-zm889-hxd6p-wnxr9][Started] Started container jnlp

最佳答案

kubectl logs <jenkins-pod> --namespace=<jenkins-namespace>是开始调试问题的一个很好的起点。
当您在 Manage Jenkins -> Configure System -> Cloud -> Kubernetes Cloud Details 下定义您的 Kubernetes 集群时, Jenkins URL 是否与 kubectl describe service jenkins 中的端点地址匹配?
端点地址必须与 Kubernetes 云详细信息中的 Jenkins URL 匹配

kubectl describe service jenkins -n jenkins | grep Endpoint
Endpoints: 192.168.151.57:8080

关于jenkins kubernetes 插件在循环中运行 Pod,并且永远不会构建作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62704602/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com