You can create a PVC (Persistent Volume Claim) like this:
name: myclaim # Name of the claim
namespace: my-test-namespace # Namespace in which the claim should be accessible/created
- ReadWriteOnce # Or ReadWriteMany if you want to allow multiple containers to use the same volume. With ReadWriteOnce you need to set
storage: 128M # Or something like 1G, ...
storageClassName: longhorn # Do not change, unless you are using a different storage driver.
Now once it has been created you can use the volume in your deployment, daemon set, ... as follows:
# Please note, information that has nothing to do with the volumes has been omitted from this example!
- name: myclaim-pvc # A random name given to mention it in this config
claimName: myclaim # The name of the claim you have given in the previous step
- name: myclaim-pvc
# Only set if you are using ReadWriteOnce. If you don't set this, your containers will fail to start!