Check this if you don't know how to:
- https://kubernetes.io/docs/concepts/storage/storage-classes/#local
- https://github.com/WGU-edu/CEGuild_EKS_Workshops/blob/main/workshop4/sidecar-containers-and-persistent-volumes.pdf
2. Create a persistent volume named pv-${yourfirstnameandlastname} that uses the storage class that you previously created.
The parameters are:
- capacity: 500Mi
- reclaim policy: recycle
- access mode: read write once
- host path: /etc/pv-${yourfirstnameandlastname}
Check this if you don't know how to:
- https://kubernetes.io/docs/concepts/storage/volumes/#local
- https://github.com/WGU-edu/CEGuild_EKS_Workshops/blob/main/workshop4/sidecar-containers-and-persistent-volumes.pdf
3. Create a persistent volume claim named pvc-${yourfirstnameandlastname} that uses the storage class that you previously created.
The parameters are:
- access mode: read write once
- storage request: 100Mi
- storage class name: the one you previously created
Check this if you don't know how to:
- https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-persistentvolumeclaim
- https://github.com/WGU-edu/CEGuild_EKS_Workshops/blob/main/workshop4/sidecar-containers-and-persistent-volumes.pdf
4. Add to the following pod definition a sidecar container that "tails" the logs of the main container:
Sidecar container properties:
- command: sh -c tail -f /input/output.log
- image: busybox
- volumeMounts: figure it out by yourself!
Pod definition:
apiVersion: v1
kind: Pod
metadata:
name: pod-jorgealvarez
spec:
containers:
- name: busybox1
image: busybox
command: ['sh', '-c', 'while true; do echo logs data > /output/output.log; sleep 1; done']
volumeMounts:
- name: sharedvol
mountPath: /output
volumes:
- name: sharedvol
persistentVolumeClaim:
claimName: pvc-jorgealvarez
Check this if you don't know how to: