Skip to content

Lab 10 - Persistent Volumes

Problem

The death star plans can't be lost no matter what happens so we need to make sure we protect them at all costs.

In order to do that you will need to do the following:

Create a PersistentVolume:

  • The PersistentVolume should be named postgresql-pv.

  • The volume needs a capacity of 1Gi.

  • Use a storageClassName of localdisk.

  • Use the accessMode ReadWriteOnce.

  • Store the data locally on the node using a hostPath volume at the location /mnt/data.

Create a PersistentVolumeClaim:

  • The PersistentVolumeClaim should be named postgresql-pv-claim.

  • Set a resource request on the claim for 500Mi of storage.

  • Use the same storageClassName and accessModes as the PersistentVolume so that this claim can bind to the PersistentVolume.

Create a Postgresql Pod configured to use the PersistentVolumeClaim: - The Pod should be named postgresql-pod.

  • Use the image bitnami/postgresql.

  • Expose the containerPort 5432.

  • Set an environment variable called MYSQL_ROOT_PASSWORD with the value password.

  • Add the PersistentVolumeClaim as a volume and mount it to the container at the path /bitnami/postgresql/.