This page explains how to create and manage persistent storage for container workloads in your Google Distributed Cloud (GDC) air-gapped sovereign universe. Persistent storage provides your application with consistent identities and stable hostnames, regardless of where its workloads are scheduled.
This page is for developers within the application operator group, who are responsible for creating application workloads for their organization. For more information, see Audiences for GDC air-gapped documentation.
Before you begin
To run commands against a Kubernetes cluster, make sure you have the following resources:
Locate the Kubernetes cluster name, or ask your Platform Administrator what the cluster name is.
Sign in and generate the kubeconfig file for the Kubernetes cluster if you don't have one.
Use the kubeconfig path of the Kubernetes cluster to replace
KUBERNETES_CLUSTER_KUBECONFIGin 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. For more information
on the available StorageClass resources in GDC, see
Persistent storage for containers.
Create a
PersistentVolumeClaimresource (PVC) and configure it with aReadWriteOnceaccess mode and astandard-rwostorage 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 EOFReplace 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 thePersistentVolumeClaimobject.
Confirm the PVC object is available:
kubectl get pvc --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG \ --namespace NAMESPACEThe output is similar to the following:
NAME CAPACITY ACCESS MODES STATUS CLAIM STORAGECLASS AGE pvc-uuid 10Gi RWO Bound pvc-name standard-rwo 60sConfigure your container workloads to use the PVC. The following is an example
nginxpod that uses astandard-rwoPVC:kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG \ --namespace NAMESPACE apply -f - <<EOF apiVersion: 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 EOFReplace
PVC_NAMEwith the PVC you created.
Expand volume capacity
To increase the capacity of a PersistentVolumeClaim object, update the
spec.resources.storage field to the new capacity. The maximum supported
volume size is 14.5 Ti.
Update the volume to a larger size in the manifest file of the
PersistentVolumeClaimobject: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 EOFReplace 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 as50Gi.
Check the status of the updated PVs in your cluster:
kubectl get pv --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG