Skip to content

Instantly share code, notes, and snippets.

@juliangroen
Created November 10, 2023 16:35
Show Gist options
  • Save juliangroen/ae5caa3d9678c17f7f5076b1ef75451c to your computer and use it in GitHub Desktop.
Save juliangroen/ae5caa3d9678c17f7f5076b1ef75451c to your computer and use it in GitHub Desktop.
workshop 4 handout

Workshop 4 Handout

1. Create a storage class named localdisk-${yourfirstnameandlastname} for local storage.

Check this if you don't know how to:

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:

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:

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment