If you are using Terraform to create GKE clusters, use gcs_fuse_csi_driver_config
field in addons_config
to enable the CSI driver. Meanwhile, make sure GKE Workload Identity and GKE Metadata Server are enabled. See the Terraform documentation for details.
The following example is a .tf
file excerpt showing how to enable the CSI driver, GKE Workload Identity, and GKE Metadata Server:
resource "google_container_cluster" "primary" {
# Enable GKE Workload Identity.
workload_identity_config {
workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
}
# Run the GKE Metadata Server on this node.
node_config {
workload_metadata_config {
mode = "GKE_METADATA"
}
}
# Enable GCS FUSE CSI driver.
addons_config {
gcs_fuse_csi_driver_config {
enabled = true
}
}
}