Neste guia de início rápido, você vai aprender a acessar buckets do Cloud Storage em um aplicativo do Google Kubernetes Engine (GKE) como se fossem sistemas de arquivos locais. Este
início rápido fornece um exemplo de manifesto do Kubernetes para criar um pod que monta o
bucket e mostra como interagir com o conteúdo do bucket usando o sistema de arquivos do
pod.
Esta página é destinada a desenvolvedores, especialistas em armazenamento e qualquer pessoa que queira provisionar e gerenciar recursos da nuvem e implantar cargas de trabalho. Para saber mais sobre papéis comuns, consulte
Tarefas e funções de usuário comuns do 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.
Substitua BUCKET_NAME pelo nome do seu bucket do Cloud Storage.
Se você estiver usando um namespace ou uma conta de serviço diferente, substitua os campos namespace
e serviceAccountName de acordo com a situação.
O conteúdo deste manifesto inicia um pod chamado gcsfuse-test que monta o bucket no caminho /data.
Verifique se ele está em execução:
kubectlgetpodgcsfuse-test
O resultado será assim:
NAME READY STATUS RESTARTS AGE
gcsfuse-test 2/2 Running 0 12s
O driver CSI do Cloud Storage FUSE anexa um contêiner secundário ao seu pod para gerenciar interações com o Cloud Storage.
Se o pod não estiver em execução, busque os registros de eventos para ajudar a diagnosticar o
problema executando o comando kubectl describe pod gcsfuse-test. Para mais informações,
consulte Solução de problemas no GitHub.
Depois que o pod estiver em execução, você poderá explorar o sistema de arquivos dele:
kubectlexec-itgcsfuse-test--find/data
Limpar
Para evitar cobranças na sua conta do Google Cloud pelos recursos usados
neste tutorial, exclua o pod:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-07-31 UTC."],[],[],null,["# Quickstart: Access Cloud Storage buckets with the FUSE CSI driver\n=================================================================\n\n[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----------------\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\n#### Check 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\n#### Grant 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------------------------------\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-----------------------------\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-------------------------------------------\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---------------------------------------------\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------------------\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\n--------------------------------------------------------------\n\n| **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\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\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)."]]