简体   繁体   English

Kubernetes 集群上的 Gitlab - 无法使用 git 进行克隆或推送

[英]Gitlab on Kubernetes Cluster - can't use git to clone or push

I've installed gitlab on my Linode Kubernetes Cluster and the UI works properly.我已经在我的 Linode Kubernetes 集群上安装了 gitlab,并且 UI 工作正常。 But I can't clone / push any repository because ssh access fails.但是我无法克隆/推送任何存储库,因为 ssh 访问失败。

git clone ssh://git@gitlab.example.com:6022/v2o/prova.git
Clone in 'prova' in corso...
git@example.com: Permission denied (publickey,password).

I've created the SSH Key pair and I've added the public one on Gitlab but nothing.我已经创建了 SSH 密钥对,并且在 Gitlab 上添加了公共密钥对,但什么也没有。

I've read some suggestions from internet and I tried to run ssh -Tv ssh://git@gitlab.example.com:6022我从互联网上阅读了一些建议,并尝试运行ssh -Tv ssh://git@gitlab.example.com:6022

debug1: Will attempt key: /Users/v20/.ssh/id_ed25519 ED25519 SHA256:1246872361472618746238bdhahdahsdhjfa explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/v2o/.ssh/id_ed25519 ED25519 SHA256:5fTy/hjLhfZ7xvLQmkxxjdddMNFiIV7auC2/U7nxsEo explicit
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
git@gitlab.example.com: Permission denied (publickey,password).

It pick up the correct key (/Users/v20/.ssh/id_ed25519) but looks like it can't connect anyway.它选择了正确的密钥 (/Users/v20/.ssh/id_ed25519) 但看起来无论如何都无法连接。

NOTE 1 I've used a NodeBalancer which expose 6022:22 port - I don't know if this configuration is correct but it's UP on Linode so I guess so注意 1我使用了一个暴露 6022:22 端口的 NodeBalancer - 我不知道这个配置是否正确,但它在 Linode 上是 UP 所以我猜是这样

NOTE 2 If I exec on runner task pod, I get an unknown version of git, redis and go.注意 2如果我在 runner 任务 pod 上执行,我会得到一个未知版本的 git、redis 和 go。 While it is fine with GO, I don't know with git/redis.虽然用 GO 没问题,但我不知道 git/redis。

git@gitlab-task-runner-7869d8d675-k4s4l:/$ gitlab-rake gitlab:env:info

System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.6.6p146
Gem Version:    2.7.10
Bundler Version:1.17.3
Rake Version:   12.3.3
Redis Version:  unknown
Git Version:    unknown
Sidekiq Version:5.2.9
Go Version:     unknown

GitLab information
Version:        13.5.3
Revision:
Directory:      /srv/gitlab
DB Adapter:     PostgreSQL
DB Version:     13.0
URL:            https://gitlab.example.com
HTTP Clone URL: https://gitlab.example.com/some-group/some-project.git
SSH Clone URL:  git@gitlab.example.com:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        13.11.0
Repository storage paths:
- default:      /var/opt/gitlab/repo
GitLab Shell path:              /home/git/gitlab-shell
Git:            /usr/bin/git

NOTE 3 the git path on the message above is wrong, that might be a problem, but I don't know how to change it :/注意 3上面消息中的 git 路径是错误的,这可能是一个问题,但我不知道如何更改它:/

I managed to solve this problem.我设法解决了这个问题。

  1. I needed to specify in the GitLab configuration (values.yaml) the shell will be expose on an high port 3xxxx so I added this part:我需要在 GitLab 配置 (values.yaml) 中指定 shell 将在高端口 3xxxx 上公开,所以我添加了这部分:
  gitlab-shell:
    enabled: true
    minReplicas: 1
    maxReplicas: 1
    # Map gitlab-shell to a high-numbered NodePort to support cloning over SSH
    service:
      type: NodePort
      nodePort: 32022
  1. Then I needed to set another variable (in the same file) global.shell.port = 22 .然后我需要设置另一个变量(在同一个文件中) global.shell.port = 22

  2. The Node balancer needed to be on port 22 -> 32022节点平衡器需要在端口 22 -> 32022

… and finally it worked like a charm! ......最后它就像一个魅力!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM