嘿,我有一个用于gitlab ci/cd管道的kubernetes集群。有一个gitlab运行器(kubernetes执行器)在上面运行。
有时管道通过,但有时我得到
Waiting for pod gitlab-runner/runner-wyplq6-h-project-7180-concurrent-0lr66z to be running, status is Pending
ContainersNotInitialized: "containers with incomplete status: [init-permissions]"
ContainersNotReady: "containers with unready status: [build helper]"
ContainersNotReady: "containers with unready status: [build helper]"
ERROR: Job failed (system failure): prepare environment: waiting for pod running: timed out waiting for pod to start. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
我检查了链接,但它说kubernetes执行器应该不会对shell配置文件造成任何问题。所以我输入kubectl describe pod gitlab-runner/runner-wyplq6-h-project-7180-concurrent-0lr66z
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 40s default-scheduler Successfully assigned gitlab-runner/runner-wyplq6-h-project-7180-concurrent-0lr66z to bloxberg
Warning FailedCreatePodContainer 5s kubelet unable to ensure pod container exists: failed to create container for [kubepods besteffort pod6fe2669a-ae7f-47e3-8794-814767c14895] : Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
为什么跑者无法启动systemd
有办法解决这个问题吗?
我查看了集群上运行的pod,似乎运行器有问题。用kubectl describe pod gitlab-runner-gitlab-runner-6b7bf4d766-9t4k6 -n gitlab-runner
我得到:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Unhealthy 7m42s (x52196 over 21d) kubelet Readiness probe failed:
Warning BackOff 2m42s (x91155 over 21d) kubelet Back-off restarting failed container
所以运行程序有问题,但是错误信息没有说明原因
根据kubernetes执行器的故障排除文档,您应该在config.toml
中增加poll_timeout
值:
在使用Kubernetes执行器时,通常会遇到以下错误:
Job failed (system failure): timed out waiting for pod to start
如果集群不能在poll_timeout定义的超时之前调度构建pod,则构建pod返回一个错误。Kubernetes Scheduler应该能够删除它。要解决此问题,请增加配置中的poll_timeout值。toml文件。
作业失败(系统故障):超时等待pod启动
如果集群不能在poll_timeout定义的超时之前调度构建pod,则会发生以下错误,构建pod返回错误。Kubernetes Scheduler应该能够删除它。要解决此问题,请增加config.toml
文件中的poll_timeout
值。
清理pod时出错,Job failed (system failure): prepare environment: waiting for pod running
Kubernetes未能及时调度job pod,出现以下错误。GitLab Runner等待pod准备好,但它失败了,然后尝试清理pod,这也可能失败。
要排除故障,检查Kubernetes主节点和运行kube-apiserver
实例的所有节点。确保它们拥有管理您希望在集群上扩展到的目标数量的pod所需的所有资源。
改变GitLab Runner等待pod到达它的Ready的时间状态,使用poll_timeout设置。
为了更好地理解pod是如何调度的,或者为什么它们不能按时调度,请阅读Kubernetes Scheduler。
有关详细信息,请参阅故障排除文档。