0

我正在尝试将 Verdaccio 部署到我的 kubernetes 集群,以用作其他组件的共享注册表。我的问题是,我似乎无法让它正确地让我的身份验证。我使用最新的 Helm-Chart 进行部署。该配置不允许注册并需要身份验证。

    # This is the config file used for the docker images.
    # It allows all users to do anything, so don't use it on production systems.
    #
    # Do not configure host and port under `listen` in this file
    # as it will be ignored when using docker.
    # see https://github.com/verdaccio/verdaccio/blob/master/docs/docker.md#docker-and-custom-port-configuration
    #
    # Look here for more config file examples:
    # https://github.com/verdaccio/verdaccio/tree/master/conf
    #

    # path to a directory with all packages
    storage: /verdaccio/storage/data

    web:
      # WebUI is enabled as default, if you want disable it, just uncomment this line
      #enable: false
      title: DiPlom NPM Registry - Verdaccio

    auth:
      htpasswd:
        file: /verdaccio/storage/htpasswd
        # Maximum amount of users allowed to register, defaults to +infinity.
        # You can set this to -1 to disable registration.
        max_users: -1

    # a list of other known repositories we can talk to
    uplinks:
      npmjs:
        url: https://registry.npmjs.org/

    packages:
      '@*/*':
        # scoped packages
        access: $authenticated
        publish: $authenticated
        # proxy: npmjs

      '**':
        # allow all users (including non-authenticated users) to read and
        # publish all packages
        #
        # you can specify usernames/groupnames (depending on your auth plugin)
        # and three keywords: $all, $anonymous, $authenticated
        access: $authenticated

        # allow all known users to publish packages
        # (anyone can register by default, remember?)
        publish: $authenticated

        # if package is not available locally, proxy requests to 'npmjs' registry
        # proxy: npmjs

    # To use `npm audit` uncomment the following section
    middlewares:
      audit:
        enabled: true

    # log settings
    logs:
      - {type: stdout, format: pretty, level: http}
      #- {type: file, path: verdaccio.log, level: info}

我需要获取用户凭据以获取相应的令牌,以便我可以从注册表中推送和拉取。但是,到目前为止,我在 HTPasswd 文件中输入的任何内容都不起作用。我查看了 GitHub 上的问题和一些如何生成 HTPasswd 条目的提示,但到目前为止还没有成功。当我尝试通过 登录时npm login,我得到以下响应:

npm ERR! code E409
npm ERR! 409 Conflict - PUT http://<IngressURL>/-/user/org.couchdb.user:admin - user registration disabled

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/<USR>/.npm/_logs/2021-08-13T10_23_30_382Z-debug.log

然后我尝试通过将 max_users 更改为 1 来配置服务器以允许注册。运行时npm adduser我得到了完全相同的响应。如果无法通过服务进行身份验证,我应该如何使用 Verdaccio?还是我错过了什么?谢谢。

更新

我玩过各种部署(docker、compose、Minikube)并发现,由 helm 图表创建的入口似乎是这里的问题。不确定究竟是什么不起作用,但只要我通过节点端口手动公开 pod,我就可以正确创建一个用户。

4

0 回答 0