带有特定文件的 gitRepo 的 Kubernetes 卷
Kubernetes volumes with gitRepo for specific file
我知道如何在启动 pod 时挂载 git 存储库。参见:
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"
太好了,但这意味着我需要克隆整个存储库。我需要的是只获取"clone"一个文件。
- 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
谢谢。
您不能只克隆一个文件。 gitRepo
执行 git clone
只允许您克隆整个存储库。
volumeMounts
不支持在其中执行命令
我知道如何在启动 pod 时挂载 git 存储库。参见:
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"
太好了,但这意味着我需要克隆整个存储库。我需要的是只获取"clone"一个文件。
- 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
谢谢。
您不能只克隆一个文件。 gitRepo
执行 git clone
只允许您克隆整个存储库。
volumeMounts
不支持在其中执行命令