Kubernetes卷与gitRepo特定文件

时间:2015-11-25 16:43:25

标签: kubernetes

我知道在启动pod时如何挂载git repo。见:

apiVersion: v1
kind: Pod
metadata:
  name: server
spec:
  containers:
  - image: nginx
    name: nginx
    volumeMounts:
    - mountPath: /mypath
      name: git-volume
  volumes:
  - name: git-volume
    gitRepo:
      repository: "git@somewhere:me/my-git-repository.git"
      revision: "22f1d8406d464b0c0874075539c1f2e96c253775"  

这很完美,但这意味着我需要克隆整个存储库。我需要的是获得"克隆"只有一个文件。

  - name: git-volume
        gitRepo:
          repository: "git@somewhere:me/my-git-repository.git/some/long/path/to/specific/file/configuration.cfg"

有可能吗?

或者我可以安装一些卷并在其中执行一些命令吗?类似的东西:

...
  containers:
  - image: nginx
    name: nginx
    volumeMounts:
    - mountPath: /mypath
      name: git-volume
      command: wget htttp://gitrepo/path/to/file/config.conf

感谢。

1 个答案:

答案 0 :(得分:3)

您不能只克隆一个文件。 gitRepo执行git clone,只允许您克隆整个存储库。

volumeMounts不支持在其中执行命令。

相关问题