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
2
Q
Persistent Volumes values
A
- ReadOnlyMany
- ReadWriteOnce
- ReadWriteMany
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
4
Q
Create a persistant volume
A
kubectl create -f pv-definition.yaml
5
Q
Get the persistent volume
A
kubectl get persistentvolume kubectl get pv