无法克隆到Kubernetes gitRepo卷中

时间:2017-03-03 03:22:23

标签: git kubernetes

我有一个YAML文件,用于在Kubernetes中创建部署,其中包括:

    volumeMounts:
    - name: git-volume
      mountPath: /code
  volumes:
  - name: git-volume
    gitRepo:
      repository: "git@bitbucket.org:organization/bot.git"
      revision: "b686122a44aa271117b602e4eba4cc02f5e56044"

我有一个公共的Bitbucket Git仓库(我可以在不登录Bitbucket的情况下查看它)。

在Kubernetes中启动部署时出现此错误:

failed to exec 'git clone git@bitbucket.org:organization/bot.git': Cloning into 'bot'... Could not create directory '/root/.ssh'.
 Failed to add the host to the list of known hosts (/root/.ssh/known_hosts).
 Permission denied (publickey).
 fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. : exit status 128

如何让这个回购克隆?

1 个答案:

答案 0 :(得分:2)

解决方案是切换到HTTPS而不是SSH(可在Bitbucket右上角的下拉列表中找到)。

即:

https://organization@bitbucket.org/organization/bot.git