• DevOps
  • devops流水线的时候podman无法登录到harbor仓库

创建部署问题时,请参考下面模板,你提供的信息越多,越容易及时获得解答。如果未按模板创建问题,管理员有权关闭问题。
确保帖子格式清晰易读,用 markdown code block 语法格式化代码块。
你只花一分钟创建的问题,不能指望别人花上半个小时给你解答。

操作系统信息
云服务器,欧拉20.0.3, 8C/64G

Kubernetes版本信息
Kubernetes 版本v1.22.1

容器运行时
集群使用的是containerd容器运行时

[root@k8s-master01 montest]# crictl version

Version: 0.1.0

RuntimeName: containerd

RuntimeVersion: v1.6.1

RuntimeApiVersion: v1alpha2

KubeSphere版本信息

在已有k8s集群上,离线安装的kubeshpere v3.4.1版本

问题是什么
我的私有仓库harbor是使用docker-compose方式安装的,并且开启了https。

Jenkinsfile登录harbor仓库的配置,我使用的是harbor的admin 用户和密码

日志如下:

而且我也已经使用的是http请求,在/etc/containers/registries.conf中配置了使用http请求方式,如下图

最后我另外找了一台服务器想测试一下podman去登录harbor, 在那台服务器上单独安装了podman, 去登录harbor仓库跟在kubesphere中报的错误是一样的,网上搜索的方式都试了,都没有解决。

各位大佬们,有没有遇到过这样的问题,如果有解决方法请赐教

16 天 后

用podman ,始终无法登录到harbor仓库,一直提示凭证无效。

最后改用docker的方式能正常使用harbor仓库,我的处理如下:

1、在三个k8s集群节点上都安装docker, 并且在都能够docker login 到harbor仓库

2、将kubesphere-devops-system / jenkins-casc-config里面所有带-podman的镜像都把-podman去掉,其它配置不做修改

3、在jenkinsfile中直接使用docker login 可以正常登录到harbor仓库。

    1 年 后

    clain 老哥,我跟你的情况一样,podman认证失败,请问podman的认证,后续你研究解决了吗?

    7 天 后

    我自建了一个harbor,在节点或pod里用podman都可以认证成功啊。需要配置 registries.conf 。

    root@base-mdcqq:/home/jenkins/agent# cat /etc/containers/registries.conf | tail -n 20
    # [[registry.mirror]]
    # location = "example-mirror-1.local/mirrors/foo"
    # insecure = true
    # # Given the above, a pull of example.com/foo/image:latest will try:
    # # 1. example-mirror-0.local/mirror-for-foo/image:latest
    # # 2. example-mirror-1.local/mirrors/foo/image:latest
    # # 3. internal-registry-for-example.com/bar/image:latest
    # # in order, and use the first one that exists.
    #
    unqualified-search-registries = ["172.31.17.46:30003"]
    
    [[registry]]
    prefix = "docker.io"
    location = "docker.io"
    
    [[registry]]
    prefix = "172.31.17.46:30003"
    location = "172.31.17.46:30003"
    insecure = true
    
    root@base-mdcqq:/home/jenkins/agent# podman login 172.31.17.46:30003
    Authenticating with existing credentials for 172.31.17.46:30003
    Existing credentials are valid. Already logged in to 172.31.17.46:30003