Use pre-provisioned volumes in OpenShift vSphere
This document describes how to use a pre-provisioned volume in your cluster.
Create a Portworx volume using pxctl
First create a volume using the Portworx CLI. On one of the nodes with Portworx installed, run the following command:
/opt/pwx/bin/pxctl volume create testvol --size 2
For more details on creating volumes using pxctl
, see Concepts.
Alternatively, you can also use snapshots that you previously created.
Use the Portworx volume
Once you have a Portworx volume, you can use it in 2 different ways:
1. Using the Portworx volume directly in a pod
You can create a pod that directly uses a Portworx volume as follows:
apiVersion: v1
kind: Pod
metadata:
name: nginx-px
spec:
containers:
- image: nginx
name: nginx-px
volumeMounts:
- mountPath: /test-portworx-volume
name: testvol
volumes:
- name: testvol
# This Portworx volume must already exist.
portworxVolume:
volumeID: testvol
note
The name and volumeID above must be the same and should be the name of the Portworx volume created using pxctl.