...

/

Using gitRepo To Mount a Git Repository

Using gitRepo To Mount a Git Repository

In this lesson, we will explore the gitRepo Volume type.

The gitRepo Volume Type

The gitRepo Volume type is probably not going to be on your list of top three Volume types. Or, maybe it will. It all depends on your use cases. We like it since it demonstrates how a concept of a Volume can be extended to a new and innovative solution.

Looking into the Definition

Let’s see it in action through the volume/github.yml definition.

Press + to interact
cat volume/github.yml

The output is as follows.

Press + to interact
apiVersion: v1
kind: Pod
metadata:
name: github
spec:
containers:
- name: github
image: docker:17.11
command: ["sleep"]
args: ["100000"]
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-socket
- mountPath: /src
name: github
volumes:
- name: docker-socket
hostPath:
path: /var/run/docker.sock
type: Socket
- name: github
gitRepo:
repository: https://github.com/vfarcic/go-demo-2.git
directory: .

This Pod definition is very similar to volume/docker.yml. The only significant difference is that we added the second ...

Access this course and 1400+ top-rated courses and projects.