add storage examples
This commit is contained in:
parent
9edb9edfd1
commit
21bb5b8561
4 changed files with 50 additions and 0 deletions
14
CKA_Course/storage/persistent_volume.yaml
Normal file
14
CKA_Course/storage/persistent_volume.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: my-pv
|
||||||
|
spec:
|
||||||
|
storageClassName: localdisk
|
||||||
|
persistentVolumeReclaimPolicy: Recycle
|
||||||
|
capacity:
|
||||||
|
storage: 1Gi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
hostPath:
|
||||||
|
path: /var/output
|
||||||
|
|
12
CKA_Course/storage/persistent_volume_claim.yaml
Normal file
12
CKA_Course/storage/persistent_volume_claim.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: my-pvc
|
||||||
|
spec:
|
||||||
|
storageClassName: localdisk
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Mi
|
||||||
|
|
17
CKA_Course/storage/storage-consumer-pod.yaml
Normal file
17
CKA_Course/storage/storage-consumer-pod.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: pv-pod
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: busybox
|
||||||
|
image: busybox
|
||||||
|
command: ['sh', '-c', 'echo Success! > /output/success.txt']
|
||||||
|
volumeMounts:
|
||||||
|
- name: pv-storage
|
||||||
|
mountPath: /output
|
||||||
|
volumes:
|
||||||
|
- name: pv-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: my-pvc
|
||||||
|
|
7
CKA_Course/storage/storage_class.yaml
Normal file
7
CKA_Course/storage/storage_class.yaml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: localdisk
|
||||||
|
provisioner: kubernetes.io/no-provisioner
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
|
Loading…
Reference in a new issue