kubernetes GitLab Job在具有相同镜像的不同(docker)运行器上失败

l2osamch  于 2023-10-17  发布在  Kubernetes
关注(0)|答案(1)|浏览(84)

我们通常通过helm-chart使用自己的Kubernetes runners设置来运行GitLab。对于特殊的工作,我们想使用一个虚拟机与ubuntu 22.04lts,dind的权利和更多的权力。安装工作和作业使用初始默认图像,我们设置python:3.11-alpine运行的预期。然而,其他作业失败与一些接缝随机文件找不到错误。例如,yaml-lint失败并出现以下错误:

Using docker image sha256:68d3b7d6ad2e3001699585e293d0458ca50cd2b2703a3411bcb88f5f56184f43 for cytopia/yamllint:latest with digest cytopia/yamllint@sha256:3e9eb827ab2b12a5ea5f49d4257bb3aca94bba9f1ba427c8bc7f2456385a5204 ...
Traceback (most recent call last):
  File "/usr/bin/yamllint", line 8, in <module>
    sys.exit(run())
  File "/usr/lib/python3.10/site-packages/yamllint/cli.py", line 208, in run
    conf = YamlLintConfig(file=args.config_file)
  File "/usr/lib/python3.10/site-packages/yamllint/config.py", line 41, in __init__
    with open(file) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'if [ -x /usr/local/bin/bash ]; then\n\texec /usr/local/bin/bash \nelif [ -x /usr/bin/bash ]; then\n\texec /usr/bin/bash \nelif [ -x /bin/bash ]; then\n\texec /bin/bash \nelif [ -x /usr/local/bin/sh ]; then\n\texec /usr/local/bin/sh \nelif [ -x /usr/bin/sh ]; then\n\texec /usr/bin/sh \nelif [ -x /bin/sh ]; then\n\texec /bin/sh \nelif [ -x /busybox/sh ]; then\n\texec /busybox/sh \nelse\n\techo shell not found\n\texit 1\nfi\n\n'

对于一个selenium作业,当尝试安装pip依赖项时,我们会得到多个[Errno 13] Permission denied: '/usr/lib/python3/dist-packages/wheel/__pycache__/__init__.cpython-38.pyc.139824642997424',最后是E: Sub-process /usr/bin/dpkg returned an error code (1)
我们尝试更改config.toml并更改默认图像,但错误保持不变。在Kubernetes中运行docker而不是VM docker设置时,路径是否可能不同?

c9x0cxw0

c9x0cxw01#

解决方案是卸载Docker(snap包),然后通过apt重新安装。仍然很想知道为什么这是有效的,而且snap包对容器内的权限有影响。

相关问题