Storage Flashcards

1
Q

What types of volume types are there? Describe them

A

emptyDir - empty dir in Pod with read write access, persisted only for the duration of the pod
hostPath - file or dir from hosts node filesystem
configMapSecret - Provides a way to inject configuration data
nfs - network file system share. Preserves data after pod restart
persistentVolumeClaim - claims a persistent volume resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the difference between emptyDir and hostPath?

A

emptyDir is persisted only for the duration of the pod and must be an empty directory, hostPath can be a directory or file and can already exist in the host or can be created on Pod startup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the use case for emptyDir and hostPath?

A

emptyDir might be used for scratch space, cache or for an algorithm
hostPath might be used when a container needs access to docker internals or if a process running inside it needs access to the host

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How would you create a volume in a pod yaml file?

A

apiVersion: v1
kind: Pod
metadata:
name: a-pod
spec:
volumes:
- name: a-volume
emptyDir: {}
container:
- name: a-container
image: nginx
volumeMounts:
- name: a-volume
mountPath: /var/logs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s the yaml file for a persistent volume?

A

apiVersion: v1
kind: PersistentVolume
metadata:
name: a-volume
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
hostPath:
path: /var/logs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the configuration optons for a pv?

A

Storage capacity : 1GI e.g.
hostPath
StorageClassName
Access modes:
- ReadWriteOnce RWO
- ReadWriteMany RWX
- ReadOnlyOnce ROX
- ReadWriteOncePod RWOP
Volume mode:
- filesystem
- block
Reclaim policy:
- Retain (Default)
- Delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the yaml file for a pvc that is statically provisioned, requires readwriteonce access and 256Mi of storage?

A

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: a-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: “”
resources:
requests:
storage: 256Mi

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

After creating a pvc what does the “Bound” status mean?

A

It means that the pvc found a pv to attatch to

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Using an yaml file, how would you attatch a pvc to a pod?

A

apiVersion: v1
kind: Pod
metadata:
name: a-pod
spec:
volumes:
- name: a-volume
persistentVolumeClaim:
claimName: a-pvc
containers:
- name: a-container
image: alpine
volumeMounts:
- name: a-volume
mountPath: /var/log

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a storage class?

A

A storage class is a kunernetes primitive that defines a specific type or claim of storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly