Access persistent storage

Google Distributed Cloud (GDC) air-gapped provides block persistent storage for virtual machine (VM) and container workloads in your air-gapped sovereign environment.

GDC uses Kubernetes, which provides persistent block and file storage through PersistentVolumeClaim objects. A PersistentVolumeClaim (PVC) is a request for storage which is referenced by a Pod object. A pod is a group of one or more containers, with shared storage and network resources. A PersistentVolumeClaim object has an independent lifecycle from the pod which allows it to persist beyond a single pod.

Persistent storage is dynamically provisioned, so that the underlying volumes are created on-demand. In GDC, dynamic provisioning is provided by the following pre-installed StorageClass objects:

  • standard-rwo: ReadWriteOnce block storage class. The volume can only be accessed by one node at a time. This storage class features an IOPS guarantee and limit of 3 IOPS per GiB.
  • system-performance-rwo: ReadWriteOnce performance block storage class. This storage class is a more performant version of RWO storage that features an IOPS guarantee and limit of 30 IOPS per GiB.

See Create stateful workloads for an example of how to deploy a stateful application with storage.

Before you begin

To run commands against a Kubernetes cluster, ensure you have the following resources:

  1. Locate the Kubernetes cluster name, or ask your Platform Administrator what the cluster name is.

  2. Sign in and generate the kubeconfig file for the Kubernetes cluster if you don't have one.

  3. Use the kubeconfig path of the Kubernetes cluster to replace KUBERNETES_CLUSTER_KUBECONFIG in these instructions.

To get the required permissions to create a persistent volume, ask your Organization IAM Admin to grant you the Namespace Admin role (namespace-admin) in your project namespace.

Create a persistent volume

The following instructions show how to create a volume using the GDC standard-rwo StorageClass.

  1. Create a PersistentVolumeClaim and configure it with a ReadWriteOnce access mode and a standard-rwo storage class:

    kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG \
        --namespace NAMESPACE apply -f - <<EOF
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: PVC_NAME
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      storageClassName: standard-rwo
    EOF
    

    Replace the following:

    • KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster.

    • NAMESPACE: the project namespace in which to create the PVC.

    • PVC_NAME: the name of the PersistentVolumeClaim object.

  2. The PersistentVolume (PV) objects are dynamically provisioned. Check the status of the new PVs in your Kubernetes cluster:

    kubectl get pv --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG
    

    The output is similar to the following:

    NAME       CAPACITY   ACCESS MODES   STATUS      CLAIM     STORAGECLASS   AGE
    pvc-uuidd  10Gi       RWO            Bound       pvc-name  standard-rwo   60s
    
  3. Configure your container workloads to use the PVC. The following is an example nginx pod that uses a standard-rwo PVC:

    kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG \
        --namespace NAMESPACE apply -f - <<EOF
    apiVersion: apps/v1
    kind: Pod
    metadata:
      name: web-server-deployment
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: data
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: PVC_NAME
    EOF
    

    Replace PVC_NAME with the PVC you created.

Expand volume capacity

To increase the capacity of a PersistentVolumeClaim object, update the spec.resources.storage field to your desired capacity. The maximum supported volume size is 14.5 Ti.

  1. Update the volume to a larger size in the manifest file of the PersistentVolumeClaim object:

    kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG \
        --namespace NAMESPACE apply -f - <<EOF
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: PVC_NAME
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: VOLUME_STORAGE_SIZE
    EOF
    

    Replace the following:

    • KUBERNETES_CLUSTER_KUBECONFIG: the kubeconfig file for the cluster.

    • NAMESPACE: the project namespace in which the PVC resource exists.

    • PVC_NAME: the name of the PVC for which you are increasing the storage size.

    • VOLUME_SNAPSHOT_SIZE: the storage size amount to increase, such as 50Gi.

  2. Check the status of the updated PVs in your cluster:

    kubectl get pv --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG