Working with storage

Persistent storage keeps data available between restarts of odo.

Adding storage to the application components

Use the odo storage command to add persistent data to your application. Examples of data that must persist include database files, dependencies, and build artifacts, such as a .m2 Maven directory.

Procedure

  1. Add the storage to your component:

    1. $ odo storage create <storage_name> --path=<path_to_the_directory> --size=<size>
  2. Push the storage to the cluster:

    1. $ odo push
  3. Verify that the storage is now attached to your component by listing all storage in the component:

    1. $ odo storage list

    Example output

    1. The component 'nodejs' has the following storage attached:
    2. NAME SIZE PATH STATE
    3. mystorage 1Gi /data Pushed
  4. Delete the storage from your component:

    1. $ odo storage delete <storage_name>
  5. List all storage to verify that the storage state is Locally Deleted:

    1. $ odo storage list

    Example output

    1. The component 'nodejs' has the following storage attached:
    2. NAME SIZE PATH STATE
    3. mystorage 1Gi /data Locally Deleted
  6. Push the changes to the cluster:

    1. $ odo push