8. State Presistence Flashcards

1
Q

How define a Volumes in a yaml file

A
apiVersion: v1
kind: Pod
metadata: 
  name: random-number-generator
spec:
  containers:
  - image: alpine
    name: alpine
    command: ["/bin/sh" , "-c"]
    args: ["shuf -i 0-100 -n 1 >> /opt/number.out;"]
    volumeMounts:
    - mountPath: /opt
      name: data-volume

    volumes:
    -name: data-volume
     hostPath: 
       path: /data
       type: Directory 
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Persistent Volumes values

A
  • ReadOnlyMany
  • ReadWriteOnce
  • ReadWriteMany
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Persistant volume definition

pv-definiton.yaml

A
apiVersion: v1
kind: PersistentVolume
metadata: 
  name: pv-vl1
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 1Gi
  hostPath:
    path: /tmp/data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Create a persistant volume

A
kubectl create -f pv-definition.yaml
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Get the persistent volume

A
kubectl get persistentvolume

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