【发布时间】:2020-02-06 03:51:19
【问题描述】:
我正在尝试使用 jenkins 和 kubernetesplugin。我使用 kubeadm 在 AWS 中部署了一个 kubernetes 集群,并在 EC2 VM 上安装了 jenkins。
我正在尝试使用 jenkins 中的管道在 kubernetes 集群中启动 Pod 的部署。
但是我总是让代理超时:
Waiting for agent to connect (30/100): mypod-67j9m-nqz0g
Feb 05, 2020 6:30:39 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
Container is terminated mypod-67j9m-nqz0g [jnlp]: ContainerStateTerminated(containerID=docker://8021b8da7c087efd6c84085032c56b5523ca7492332e441fa302a561b93b9829, exitCode=255, finishedAt=2020-02-05T18:30:38Z, message=null, reason=Error, signal=null, startedAt=2020-02-05T18:30:07Z, additionalProperties={})
Feb 05, 2020 6:30:39 PM SEVERE org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher logLastLines
Error in provisioning; agent=KubernetesSlave name: mypod-67j9m-nqz0g, template=PodTemplate{, name='mypod-67j9m', label='mypod', nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], containers=[ContainerTemplate{name='golang', image='golang:1.8.0', command='cat', ttyEnabled=true}], annotations=[org.csanchez.jenkins.plugins.kubernetes.PodAnnotation@aab9c821]}. Container jnlp exited with error 255. Logs: Feb 05, 2020 6:30:08 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/jenkins/agent/remoting
Feb 05, 2020 6:30:08 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://ec2-18-140-64-62.ap-southeast-1.compute.amazonaws.com:8080/]
Feb 05, 2020 6:30:38 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Failed to connect to http://xxxxx.ap-southeast-1.compute.amazonaws.com:8080/tcpSlaveAgentListener/: connect timed out
我的 pod 正在运行,但从属 pod 没有响应,并且消息指出
JNLP agent port is disabled and agents cannot connect this way
这是我目前的设置
podTemplate(cloud: 'kubernetes', label: 'mypod',containers: [
containerTemplate(name: 'golang', image: 'golang:1.8.0', ttyEnabled: true, command: 'cat')
]) {
node('mypod') {
stage('Get a Golang project') {
git url: 'https://github.com/hashicorp/terraform.git'
container('golang') {
stage('Build a Go project') {
sh 'echo hello world'
}
}
}
}
}
【问题讨论】:
标签: jenkins kubernetes