和 emptyDir 很類似,差別在於第 18~20 行,指出了 git repository 及 revision,第 21 行則指出 clone 下來的內容要放在 volume 的當前目錄。
- apiVersion: v1
- kind: Pod
- metadata:
- name: host-git
- spec:
- containers:
- - name: host-git
- image: centos:7
- command:
- - "bin/bash"
- - "-c"
- - "sleep 10000"
- volumeMounts:
- - name: jar
- mountPath: /home/steven/host
- volumes:
- - name: jar
- gitRepo:
- repository: https://github.com/twleader/RESTAPI.git
- revision: master
- directory: .
如上執行 yaml 後建立起 pod host-git。接下用 exec 指令進入 pod 裡面看一下 /home/steven/host 目錄裡有沒有 clone 下來的檔案。
非常順利。
沒有留言:
張貼留言