Dans ce guide de démarrage rapide, vous allez apprendre à accéder aux buckets Cloud Storage depuis une application Google Kubernetes Engine (GKE) comme s'il s'agissait de systèmes de fichiers locaux. Ce guide de démarrage rapide fournit un exemple de fichier manifeste Kubernetes permettant de créer un pod qui installe le bucket. Il vous montre également comment interagir avec le contenu du bucket à l'aide du système de fichiers du pod.
Cette page s'adresse aux développeurs, aux spécialistes du stockage et à toute personne souhaitant provisionner et gérer des ressources cloud, et déployer des charges de travail. Pour en savoir plus sur les rôles courants, consultez Rôles utilisateur et tâches courantes de GKE.
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
In the Principal column, find all rows that identify you or a group that
you're included in. To learn which groups you're included in, contact your
administrator.
For all rows that specify or include you, check the Role column to see whether
the list of roles includes the required roles.
Dans la liste des buckets, cliquez sur le nom de celui que vous venez de créer.
Dans l'onglet Objets du bucket, effectuez l'une des actions suivantes :
Faites glisser des fichiers de votre bureau ou de votre gestionnaire de fichiers vers le volet principal de la console Google Cloud .
Cliquez sur le bouton Importer des fichiers. Dans la boîte de dialogue qui s'affiche, sélectionnez les fichiers que vous souhaitez importer, puis cliquez sur Ouvrir.
Remplacez BUCKET_NAME par le nom de votre bucket Cloud Storage.
Si vous utilisez un autre espace de noms ou un autre compte de service, remplacez les champs namespace et serviceAccountName en conséquence.
Le contenu de ce fichier manifeste lance un pod appelé gcsfuse-test qui installe le bucket sur son chemin d'accès /data.
Vérifiez qu'il est en cours d'exécution :
kubectlgetpodgcsfuse-test
Le résultat ressemble à ce qui suit :
NAME READY STATUS RESTARTS AGE
gcsfuse-test 2/2 Running 0 12s
Le pilote CSI Cloud Storage FUSE associe un conteneur side-car à votre pod pour gérer les interactions avec Cloud Storage.
Si le pod n'est pas en cours d'exécution, vous pouvez récupérer les journaux d'événements pour vous aider à diagnostiquer le problème en exécutant la commande kubectl describe pod gcsfuse-test. Pour en savoir plus, consultez la section Dépannage sur GitHub.
Une fois le pod en cours d'exécution, vous pouvez explorer son système de fichiers :
kubectlexec-itgcsfuse-test--find/data
Effectuer un nettoyage
Pour éviter que les ressources utilisées dans ce tutoriel ne soient facturées sur votre compte Google Cloud , supprimez le pod :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/01 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/01 (UTC)."],[],[],null,["Quickstart: Access Cloud Storage buckets with the FUSE CSI driver [Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview)\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nIn this quickstart guide, you learn how to access Cloud Storage buckets from within\na Google Kubernetes Engine (GKE) application as if they were local file systems. This\nquickstart provides a sample Kubernetes manifest to create a Pod that mounts the\nbucket, and shows you how to interact with the bucket's contents using the Pod's file\nsystem.\n\nThis page is for Developers, Storage specialists, and anyone else\nwho wants to provision and manage cloud resources, and deploy workloads. To\nlearn more about common roles, see\n[Common GKE user roles and tasks](/kubernetes-engine/enterprise/docs/concepts/roles-tasks).\n\nBefore reading this page, ensure that you're familiar with [Kubernetes](https://kubernetes.io/)\nand [Cloud Storage FUSE CSI driver](/kubernetes-engine/docs/concepts/cloud-storage-fuse-csi-driver).\n\nThis quickstart uses the GKE Autopilot mode. If you want to use the\nStandard mode, see [Set up the Cloud Storage FUSE CSI driver for GKE](/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-setup#standard).\n\nBefore you begin\n\nSign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n\nIn the Google Cloud console, on the project selector page,\nselect or create a Google Cloud project.\n| **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n[Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n\n\n[Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n\n[Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=container.googleapis.com,storage.googleapis.com) \nIn the Google Cloud console, on the project selector page,\nselect or create a Google Cloud project.\n| **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n[Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n\n\n[Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n\n[Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=container.googleapis.com,storage.googleapis.com)\n1. Make sure that you have the following role or roles on the project: Kubernetes Engine Admin, Storage Admin, Service Account User\n\nCheck for the roles\n\n1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n2. Select the project.\n3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\nGrant the roles\n\n1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n2. Select the project.\n3. Click person_add **Grant access**.\n4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n5. In the **Select a role** list, select a role.\n6. To grant additional roles, click add **Add\n another role** and add each additional role.\n7. Click **Save**.\n\nCreate a GKE Autopilot cluster\n\n1.\n\n\n In the Google Cloud console, go to the **Create an Autopilot cluster** page.\n\n [Go to Create an Autopilot cluster](https://console.cloud.google.com/kubernetes/auto/add)\n\n \u003cbr /\u003e\n\n2. Under **Cluster basics**, do the following:\n\n 1. In the **Name** field, enter a name for the cluster.\n\n 2. Keep the default values for the rest of the settings.\n\n3. To create the cluster, click **Create**.\n\nCreate a Cloud Storage bucket\n\n1. In the Google Cloud console, go to the Cloud Storage **Buckets** page. \n\n [Go to Buckets](https://console.cloud.google.com/storage/browser)\n2. Click add_box **Create**.\n\n3. On the **Create a bucket** page, in the **Get started** section, do the following:\n\n 1. Enter a globally unique name for your bucket that meets the\n [bucket naming requirements](/storage/docs/buckets#naming).\n\n 2. Keep the default values for the rest of the settings.\n\n4. To create the bucket, click **Create**.\n\nUpload objects to your Cloud Storage bucket\n\n1. In the Google Cloud console, go to the Cloud Storage **Buckets** page. \n\n [Go to Buckets](https://console.cloud.google.com/storage/browser)\n2. In the list of buckets, click the name of the bucket that you just created.\n\n3. In the **Objects** tab for the bucket, do either of the following:\n\n - Drag files from your desktop or file manager\n to the main pane in the Google Cloud console.\n\n - Click the **Upload Files** button. In the dialog that appears, select the\n files that you want to upload, and click **Open**.\n\n | **Note:** If you're using the Chrome browser, folder uploads are also supported.\n\nConfigure access to your Cloud Storage bucket\n\nTo make sure your Cloud Storage bucket is accessible by your GKE\ncluster, follow the steps in [Configure access to Cloud Storage buckets](/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-setup#authentication).\n\nSet up Cloud Shell\n\nIn the Google Cloud console, activate Cloud Shell.\n\n[Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n\nA [Cloud Shell](/shell/docs/how-cloud-shell-works) session starts and displays a command-line prompt. It can take a few seconds for the session to initialize.\n\nDeploy a Pod to access your Cloud Storage bucket by using FUSE **Note:** To optimize your configuration, see [Optimize Cloud Storage Cloud Storage FUSE CSI driver for GKE performance](/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-perf).\n\n1. Set the default project where you want\n to deploy the Pod:\n\n gcloud config set project \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your project ID.\n2. Create and apply the Pod manifest with the following content:\n\n cat \u003c\u003c EOF | kubectl apply -f -\n apiVersion: v1\n kind: Pod\n metadata:\n name: gcsfuse-test\n namespace: default\n annotations:\n gke-gcsfuse/volumes: \"true\"\n spec:\n terminationGracePeriodSeconds: 60\n containers:\n - image: busybox\n name: busybox\n command: [\"sleep\"]\n args: [\"infinity\"]\n volumeMounts:\n - name: gcsfuse-test\n mountPath: /data\n readOnly: true\n serviceAccountName: default\n volumes:\n - name: gcsfuse-test\n csi:\n driver: gcsfuse.csi.storage.gke.io\n volumeAttributes:\n bucketName: \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e\n mountOptions: \"implicit-dirs\"\n EOF\n\n - Replace \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e with your Cloud Storage bucket name.\n - If you're using a different namespace or a service account, replace the `namespace` and `serviceAccountName` fields accordingly.\n\n The content of this manifest starts a Pod called `gcsfuse-test` that mounts the bucket on its `/data` path.\n3. Verify that the Pod is running:\n\n kubectl get pod gcsfuse-test\n\n The output is similar to the following: \n\n NAME READY STATUS RESTARTS AGE\n gcsfuse-test 2/2 Running 0 12s\n\n The Cloud Storage FUSE CSI driver [attaches a sidecar container](https://kubernetes.io/blog/2023/08/25/native-sidecar-containers/) in your Pod to manage interactions with Cloud Storage.\n\n If the Pod isn't running, you can fetch the event logs to help you diagnose the\n issue by running the `kubectl describe pod gcsfuse-test` command. For more information,\n see [Troubleshooting](https://github.com/GoogleCloudPlatform/gcs-fuse-csi-driver/blob/main/docs/troubleshooting.md#pod-event-warnings) on GitHub.\n4. After the Pod is running, you can explore its file system:\n\n kubectl exec -it gcsfuse-test -- find /data\n\n | **Success:** You've successfully accessed your Cloud Storage bucket as a local file system!\n\nClean up\n\n\u003cbr /\u003e\n\nTo avoid incurring charges to your Google Cloud account for the resources that you used\nin this tutorial, delete the Pod: \n\n kubectl delete pod gcsfuse-test\n\nWhat's next\n\n- [Learn how the Cloud Storage FUSE CSI driver for GKE works](/kubernetes-engine/docs/concepts/cloud-storage-fuse-csi-driver).\n- [Learn more about the capabilities of Cloud Storage FUSE](/storage/docs/cloud-storage-fuse/overview).\n- [Troubleshoot Cloud Storage FUSE](https://github.com/GoogleCloudPlatform/gcs-fuse-csi-driver/blob/main/docs/troubleshooting.md).\n- [Optimize Cloud Storage FUSE for performance](/kubernetes-engine/docs/how-to/cloud-storage-fuse-csi-driver-perf)."]]