This module creates Kubernetes Persistent Volumes (PV) and Persistent Volume Claims (PVC) that can be used by a [gke-job-template].
gke-persistent-volume works with Filestore, Google Cloud Storage and Managed Lustre. Each
gke-persistent-volume can only be used with a single file system so if multiple
shared file systems are used then multiple gke-persistent-volume modules are
needed in the blueprint.
NOTE: This is an experimental module and the functionality and documentation will likely be updated in the near future. This module has only been tested in limited capacity.
The following example creates a Filestore and then uses the
gke-persistent-volume module to use the Filestore as shared storage in a
gke-job-template.
- id: gke_cluster
source: modules/scheduler/gke-cluster
use: [network1]
settings:
master_authorized_networks:
- display_name: deployment-machine
cidr_block: <your-ip-address>/32
- id: datafs
source: modules/file-system/filestore
use: [network1]
settings:
local_mount: /data
- id: datafs-pv
source: modules/file-system/gke-persistent-volume
use: [datafs, gke_cluster]
- id: job-template
source: modules/compute/gke-job-template
use: [datafs-pv, compute_pool, gke_cluster]The following example creates a GCS bucket and then uses the
gke-persistent-volume module to use the bucket as shared storage in a
gke-job-template.
- id: gke_cluster
source: modules/scheduler/gke-cluster
use: [network1]
settings:
master_authorized_networks:
- display_name: deployment-machine
cidr_block: <your-ip-address>/32
- id: data-bucket
source: modules/file-system/cloud-storage-bucket
settings:
local_mount: /data
- id: datagcs-pv
source: modules/file-system/gke-persistent-volume
use: [data-bucket, gke_cluster]
- id: job-template
source: modules/compute/gke-job-template
use: [datagcs-pv, compute_pool, gke_cluster]The following example creates a Managed Lustre and then uses the
gke-persistent-volume module to use the Lustre as shared storage in a
gke-job-template.
- id: gke_cluster
source: modules/scheduler/gke-cluster
use: [network1]
settings:
master_authorized_networks:
- display_name: deployment-machine
cidr_block: <your-ip-address>/32
- id: data-managedlustre
source: modules/file-system/managed-lustre
settings:
local_mount: /data
- id: datalustre-pv
source: modules/file-system/gke-persistent-volume
use: [data-managedlustre, gke_cluster]
- id: job-template
source: modules/compute/gke-job-template
use: [datalustre-pv, compute_pool, gke_cluster]See example storage-gke.yaml blueprint for a complete example.
Since the gke-persistent-volume module is making calls to the Kubernetes API
to create Kubernetes entities, the machine performing the deployment must be
authorized to connect to the Kubernetes API. You can add the
master_authorized_networks settings block, as shown in the example above, with
the IP address of the machine performing the deployment. This will ensure that
the deploying machine can connect to the cluster.
The diagram below shows the valid use relationships for the GKE Cluster Toolkit
modules. For example the gke-persistent-volume module can use a
gke-cluster module and a filestore module, as shown in the example above.
graph TD;
vpc--> |OneToMany| gke-cluster;
gke-cluster--> |OneToMany| gke-node-pool;
gke-node-pool--> |ManyToMany| gke-job-template;
gke-cluster--> |OneToMany| gke-persistent-volume;
gke-persistent-volume--> |ManyToMany| gke-job-template;
vpc--> |OneToMany| filestore;
vpc--> |OneToMany| gcs;
vpc--> |OneToMany| managed-lustre;
filestore--> |OneToOne| gke-persistent-volume;
gcs--> |OneToOne| gke-persistent-volume;
managed-lustre--> |OneToOne| gke-persistent-volume;
Copyright 2026 Google LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| Name | Version |
|---|---|
| terraform | = 1.12.2 |
| >= 4.42 | |
| kubectl | >= 1.7.0 |
| Name | Version |
|---|---|
| >= 4.42 | |
| kubectl | >= 1.7.0 |
No modules.
| Name | Type |
|---|---|
| kubectl_manifest.pv | resource |
| kubectl_manifest.pvc | resource |
| kubectl_manifest.pvc_namespace | resource |
| google_client_config.default | data source |
| google_container_cluster.gke_cluster | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| capacity_gib | The storage capacity with which to create the persistent volume. | number |
n/a | yes |
| cluster_id | An identifier for the GKE cluster in the format projects/{{project}}/locations/{{location}}/clusters/{{cluster}} |
string |
n/a | yes |
| filestore_id | An identifier for a filestore with the format projects/{{project}}/locations/{{location}}/instances/{{name}}. |
string |
null |
no |
| gcs_bucket_name | The gcs bucket to be used with the persistent volume. | string |
null |
no |
| labels | GCE resource labels to be applied to resources. Key-value pairs. | map(string) |
n/a | yes |
| lustre_id | An identifier for a lustre with the format projects/{{project}}/locations/{{location}}/instances/{{name}}. |
string |
null |
no |
| namespace | Kubernetes namespace to deploy the storage PVC/PV | string |
"default" |
no |
| network_storage | Network attached storage mount to be configured. | object({ |
n/a | yes |
| pv_name | The name for PV. IF not set, a name will be generated based on the storage name. | string |
null |
no |
| pvc_name | The name for PVC. IF not set, a name will be generated based on the storage name. | string |
null |
no |
| Name | Description |
|---|---|
| persistent_volume_claims | An object describing the Kubernetes PersistentVolumeClaim created by this module. |
| pvc_name | The name of the Kubernetes PVC created by this module. |