![]() - Add a new type PortworxVolumeSource - Implement the kubernetes volume plugin for Portworx Volumes under pkg/volume/portworx - The Portworx Volume Driver uses the libopenstorage/openstorage specifications and apis for volume operations. Changes for k8s configuration and examples for portworx volumes. - Add PortworxVolume hooks in kubectl, kube-controller-manager and validation. - Add a README for PortworxVolume usage as PVs, PVCs and StorageClass. - Add example spec files Handle code review comments. - Modified READMEs to incorporate to suggestions. - Add a test for ReadWriteMany access mode. - Use util.UnmountPath in TearDown. - Add ReadOnly flag to PortworxVolumeSource - Use hostname:port instead of unix sockets - Delete the mount dir in TearDown. - Fix link issue in persistentvolumes README - In unit test check for mountpath after Setup is done. - Add PVC Claim Name as a Portworx Volume Label Generated code and documentation. - Updated swagger spec - Updated api-reference docs - Updated generated code under pkg/api/v1 Godeps update for Portworx Volume Driver - Adds github.com/libopenstorage/openstorage - Adds go.pedge.io/pb/go/google/protobuf - Updates Godep Licenses |
||
---|---|---|
.. | ||
README.md | ||
portworx-volume-pod.yaml | ||
portworx-volume-pv.yaml | ||
portworx-volume-pvc.yaml | ||
portworx-volume-pvcpod.yaml | ||
portworx-volume-pvcsc.yaml | ||
portworx-volume-pvcscpod.yaml | ||
portworx-volume-sc-high.yaml |
README.md
Portworx Volume
Portworx
Portworx can be used as a storage provider for your Kubernetes cluster. Portworx pools your servers capacity and turns your servers or cloud instances into converged, highly available compute and storage nodes
Prerequisites
- A Portworx instance running on all of your Kubernetes nodes. For more information on how you can install Portworx can be found here
Examples
The following examples assumes that you already have a running Kubernetes cluster with Portworx installed on all nodes.
Using Pre-provisioned Portworx Volumes
Create a Volume using Portworx CLI. On one of the Kubernetes nodes with Portworx installed run the following command
/opt/pwx/bin/pxctl volume create <vol-id> --size <size> --fs <fs-type>
Running Pods
Create Pod which uses Portworx Volumes
Example spec:
apiVersion: v1
kind: Pod
metadata:
name: test-portworx-volume-pod
spec:
containers:
- image: gcr.io/google_containers/test-webserver
name: test-container
volumeMounts:
- mountPath: /test-portworx-volume
name: test-volume
volumes:
- name: test-volume
# This Portworx volume must already exist.
portworxVolume:
volumeID: "<vol-id>"
fsType: "<fs-type>"
Make sure to replace and in the above spec with the ones that you used while creating the volume.
Create the Pod.
$ kubectl create -f examples/volumes/portworx/portworx-volume-pod.yaml
Verify that pod is running:
$ kubectl.sh get pods
NAME READY STATUS RESTARTS AGE
test-portworx-volume-pod 1/1 Running 0 16s
Persistent Volumes
-
Create Persistent Volume.
Example spec:
apiVersion: v1 kind: PersistentVolume metadata: name: <vol-id> spec: capacity: storage: <size>Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain portworxVolume: volumeID: "<vol-id>" fsType: "<fs-type>"
Make sure to replace , and in the above spec with the ones that you used while creating the volume.
Creating the persistent volume:
$ kubectl create -f examples/volumes/portworx/portworx-volume-pv.yaml
Verifying persistent volume is created:
$ kubectl describe pv pv0001 Name: pv0001 Labels: <none> StorageClass: Status: Available Claim: Reclaim Policy: Retain Access Modes: RWO Capacity: 2Gi Message: Source: Type: PortworxVolume (a Portworx Persistent Volume resource) VolumeID: pv0001 FSType: ext4 No events.
-
Create Persistent Volume Claim.
Example spec:
kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvc0001 spec: accessModes: - ReadWriteOnce resources: requests: storage: <size>Gi
Creating the persistent volume claim:
$ kubectl create -f examples/volumes/portworx/portworx-volume-pvc.yaml
Verifying persistent volume claim is created:
$ kubectl describe pvc pvc0001 Name: pvc0001 Namespace: default Status: Bound Volume: pv0001 Labels: <none> Capacity: 2Gi Access Modes: RWO No events.
-
Create Pod which uses Persistent Volume Claim.
See example:
apiVersion: v1 kind: Pod metadata: name: pvpod spec: containers: - name: test-container image: gcr.io/google_containers/test-webserver volumeMounts: - name: test-volume mountPath: /test-portworx-volume volumes: - name: test-volume persistentVolumeClaim: claimName: pvc0001
Creating the pod:
$ kubectl create -f examples/volumes/portworx/portworx-volume-pvcpod.yaml
Verifying pod is created:
$ kubectl get pod pvpod NAME READY STATUS RESTARTS AGE pvpod 1/1 Running 0 48m
Using Dynamic Provisioning
Using Dynamic Provisioning and Storage Classes you don't need to create Portworx volumes out of band and they will be created automatically.
Storage Class
Using Storage Classes objects an admin can define the different classes of Portworx Volumes that are offered in a cluster. Following are the different parameters that can be used to define a Portworx Storage Class
fs
: filesystem to be laid out: none|xfs|ext4 (default:ext4
)block_size
: block size in Kbytes (default:32
)repl
: replication factor [1..3] (default:1
)io_priority
: IO Priority: [high|medium|low] (default:low
)snap_interval
: snapshot interval in minutes, 0 disables snaps (default:0
)aggregation_level
: specifies the number of replication sets the volume can be aggregated from (default:1
)ephemeral
: ephemeral storage [true|false] (defaultfalse
)
-
Create Storage Class.
See example:
kind: StorageClass apiVersion: storage.k8s.io/v1beta1 metadata: name: portworx-io-priority-high provisioner: kubernetes.io/portworx-volume parameters: repl: "1" snap_interval: "70" io_priority: "high"
Creating the storageclass:
$ kubectl create -f examples/volumes/portworx/portworx-volume-sc-high.yaml
Verifying storage class is created:
$ kubectl describe storageclass portworx-io-priority-high Name: portworx-io-priority-high IsDefaultClass: No Annotations: <none> Provisioner: kubernetes.io/portworx-volume Parameters: io_priority=high,repl=1,snapshot_interval=70 No events.
-
Create Persistent Volume Claim.
See example:
kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvcsc001 annotations: volume.beta.kubernetes.io/storage-class: portworx-io-priority-high spec: accessModes: - ReadWriteOnce resources: requests: storage: 2Gi
Creating the persistent volume claim:
$ kubectl create -f examples/volumes/portworx/portworx-volume-pvcsc.yaml
Verifying persistent volume claim is created:
$ kubectl describe pvc pvcsc001 Name: pvcsc001 Namespace: default StorageClass: portworx-io-priority-high Status: Bound Volume: pvc-e5578707-c626-11e6-baf6-08002729a32b Labels: <none> Capacity: 2Gi Access Modes: RWO No Events
Persistent Volume is automatically created and is bounded to this pvc.
Verifying persistent volume claim is created:
$ kubectl describe pv pvc-e5578707-c626-11e6-baf6-08002729a32b Name: pvc-e5578707-c626-11e6-baf6-08002729a32b Labels: <none> StorageClass: portworx-io-priority-high Status: Bound Claim: default/pvcsc001 Reclaim Policy: Delete Access Modes: RWO Capacity: 2Gi Message: Source: Type: PortworxVolume (a Portworx Persistent Volume resource) VolumeID: 374093969022973811 No events.
-
Create Pod which uses Persistent Volume Claim with storage class.
See example:
apiVersion: v1 kind: Pod metadata: name: pvpod spec: containers: - name: test-container image: gcr.io/google_containers/test-webserver volumeMounts: - name: test-volume mountPath: /test-portworx-volume volumes: - name: test-volume persistentVolumeClaim: claimName: pvcsc001
Creating the pod:
$ kubectl create -f examples/volumes/portworx/portworx-volume-pvcscpod.yaml
Verifying pod is created:
$ kubectl get pod pvpod NAME READY STATUS RESTARTS AGE pvpod 1/1 Running 0 48m