PX-Enterprise: The first containerized storage system to support CSI on Kubernetes

CSI container storage interface logo

Portworx PX-Enterprise 1.4 now comes with Technical Preview support for CSI; the new standard storage interface for containerized applications. Portworx is proud to be the first fully containerized storage system to support the CSI standard. In this blog we will show you how to deploy an application consuming storage from Portworx PX-Enterprise 1.4 integrated with Kubernetes v1.10 via CSI.

Container Storage Interface, or CSI, is the new model for integrating storage system drivers with container orchestration systems like Kubernetes, Docker, or Mesosphere. This new interface is a major benefit to the container ecosystem as it standardizes the model of integrating storage systems with container orchestration systems. Specifically for Kubernetes, it frees the storage system driver from being tied to the Kubernetes release schedule due to it being incorporated in the same code base. With CSI, storage system drivers can now be installed asynchronously to container orchestration releases, providing faster bug fixes and features.

The CSI interface specification, now at v0.2, is maintained by community members from both container orchestration systems and storage vendors. CSI requires that both container orchestration systems, like Kubernetes, and storage drivers, like Portworx, have implementations supporting the specification. We are proud to be part of both the CSI community and the Kubernetes-CSI implementation team, bringing CSI v0.2 support to Kubernetes v1.10 as Beta. Portworx is fully committed to CSI and as soon as CSI is GA in Kubernetes, we will GA our own CSI driver.

Setting PX-Enterprise with CSI

Portworx provides support for deploying PX-Enterprise with support for CSI. It is as easy as enabling the choice on the installer page (see picture below):

install-portworx-with-csi

Once you execute the command to deploy Portworx, you will need to wait until all the Portworx containers are ready. Here is an example output:

portworx-gvtf2 2/2 Running 3 2d
portworx-k8rvf 2/2 Running 2 2d
portworx-mz5d9 2/2 Running 2 2d
px-csi-ext-0   2/2 Running 2 2d

If you are already familiar with Portworx you will notice that there are now two containers as part of the Pod. The Pod now contains the CSI-based Portworx container and the new CSI driver registrar. The driver registrar is responsible for registration of the CSI driver with the Kubernetes node. You may also notice the StatefulSet Pod called px-csi-ext-0 which houses both the external-provisioner and external-attacher CSI containers. The external-provisioner provides support for volume dynamic provisioning and the external-attacher manages attachment of the volume to the node. These three new CSI containers are provided by the Kubernetes-CSI community to help CSI drivers integrate with Kubernetes.

Once ready, you can run pxctl to get the status of the cluster as follows:

$ kubectl -n kube-system exec {portworx pod name} -c portworx -- /opt/pwx/bin/pxctl status

Where {portworx pod name} is the name of one of the Portworx Pods.

Lastly, to enable dynamic provisioning of volumes, you will need to create and submit at least one StorageClass as shown in the example below:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: portworx
provisioner: com.openstorage.pxd
parameters:
  repl: "3"

Deploying an application on Kubernetes with CSI

Requesting storage from Portworx deployed as a CSI driver is done exactly as before. As a user, you would create an application PersistentVolumeClaim, or PVC, describing the storage needed. Kubernetes would then notice the StorageClass referenced by the PVC and call the CSI Portworx driver to provision the storage for your application.

In the example below, a CockroachDB StatefulSet application has defined that storage should come from the Portworx StorageClass as shown below:

volumeClaimTemplates:
  - metadata:
    name: datadir
    annotations:
      volume.beta.kubernetes.io/storage-class: portworx
  spec:
    accessModes:
      - "ReadWriteOnce"
    resources:
      requests:
        storage: 10Gi

Kubernetes would then dynamically provision storage from Portworx using CSI. If the StatefulSet is scaled to three running Pods, then the final result would look as follows:

NAME READY STATUS RESTARTS AGE
cockroachdb-0 1/1 Running 0 2d
cockroachdb-1 1/1 Running 0 2d
cockroachdb-2 1/1 Running 0 2d

What’s next?

We are currently hard at work bringing new features in CSI 0.3 like SnapShots, working with the Kuberntes-CSI community to stabilize Kubernetes-CSI containers, and bringing best-in-class Portworx technology to CSI enabled container orchestration systems.

Written by Luis Pabón

Luis Pabon Portworx