Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Criar um app com dependências de configuração
Neste guia de início rápido, você vai configurar um aplicativo com dependências de configuração
baseadas em um aplicativo de amostra e, em seguida, implantar partes do app separadamente.
Antes de começar
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.
Para abrir o espaço de trabalho com base no Bank of Anthos, no VS Code, clique em Arquivo >
Abrir pasta e navegue até a pasta em que o repositório foi
clonado.
Clique duas vezes no arquivo skaffold.yaml.
O arquivo contém várias configurações, separadas por separadores de documentos
YAML (---). Cada configuração pode ser implantada ou referenciada como uma
dependência separadamente.
---apiVersion:skaffold/v2beta18kind:Config
As configurações com um nome especificado são conhecidas como módulos do Skaffold.
O trecho a seguir define o módulo frontend.
metadata:name:frontend# module defining frontend service
As dependências entre configurações são especificadas usando a tag configs. As configurações necessárias precisam ser implantadas antes da configuração atual. O exemplo mostra uma dependência definida no mesmo
arquivo. A tag configs também pode referenciar outros arquivos skaffold.yaml no projeto atual.
requires:-configs:[db]
Como implantar módulos
Abra a paleta de comandos (Ctrl/Cmd+Shift+P) e execute
Cloud Code: Run on Kubernetes.
Clique em Select modules.
Escolha os módulos que você quer implantar e clique em OK.
Se você clicar em db, a configuração db e a configuração setup necessária serão criadas.
Quando solicitado, escolha um registro de imagem e pressione Enter.
Limpar
Depois do encerramento do aplicativo, todos os recursos do Kubernetes implantados durante a execução são excluídos automaticamente.
Para evitar cobranças na sua conta por outros recursos usados neste guia de início rápido, exclua o cluster e o projeto criados.
Se você estiver usando Google Cloud e quiser excluir apenas seu cluster, siga estas etapas:
Clique em Cloud Code e expanda o explorador do Kubernetes.
Passe o cursor sobre o nome do cluster e clique em
open_in_newAbrir no console do Google Cloud .
Clique em Excluir e em Excluir.
Para excluir o projeto (e os recursos associados, incluindo os clusters):
Acesse a página "Projetos" no console Google Cloud :
[[["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-08-11 UTC."],[[["\u003cp\u003eThis guide demonstrates how to set up an application with configuration dependencies and deploy parts of it separately using Skaffold modules.\u003c/p\u003e\n"],["\u003cp\u003eSkaffold modules, defined by a name within the \u003ccode\u003eskaffold.yaml\u003c/code\u003e file, allow for the separate deployment of configurations, including defining dependencies via the \u003ccode\u003econfigs\u003c/code\u003e tag.\u003c/p\u003e\n"],["\u003cp\u003eTo deploy selected modules, use the "Cloud Code: Run on Kubernetes" command in VS Code, and select the desired modules.\u003c/p\u003e\n"],["\u003cp\u003eThe guide highlights the cleanup process, including the automatic deletion of Kubernetes resources after application termination and instructions for manually deleting the cluster or project in Google Cloud.\u003c/p\u003e\n"],["\u003cp\u003eThe guide directs to further resources such as learning about Skaffold modules, language specific debugging, and configuring settings.\u003c/p\u003e\n"]]],[],null,["# Create an app with configuration dependencies\n=============================================\n\nIn this quickstart, you set up an application with configuration dependencies\nbased on a sample application and then deploy parts of the app separately.\n\nBefore you begin\n----------------\n\n- Sign 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- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\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 [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\n\n Enable the Google Kubernetes Engine API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=container.googleapis.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\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 [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\n\n Enable the Google Kubernetes Engine API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=container.googleapis.com)\n\n1. Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). Git is required for copying samples to your machine.\n2. Install the [Cloud Code plugin](/code/docs/vscode/install#installing) if you haven't already.\n\nCreating an application\n-----------------------\n\n1. Clone the Bank of Anthos repository:\n\n 1. In the top menu bar, click **Terminal** \\\u003e **New Terminal**.\n 2. Clone the Bank of Anthos repository:\n\n git clone https://github.com/GoogleCloudPlatform/bank-of-anthos.git\n\n2. To open the workspace based on Bank of Anthos, in VS Code, click **File** \\\u003e\n **Open folder** and then navigate to the folder where the repository was\n cloned.\n\n3. Double-click the `skaffold.yaml` file.\n\n 1. The file contains multiple configurations, separated by YAML document\n separators (`---`). Each configuration can be deployed or referenced as a\n dependency separately.\n\n ---\n apiVersion: skaffold/v2beta18\n kind: Config\n\n 2. Configurations with a name specified are known as *Skaffold modules* .\n The following excerpt defines the `frontend` module.\n\n metadata:\n name: frontend # module defining frontend service\n\n 3. Dependencies between configurations are specified using the `configs`\n tag. Required configurations must be deployed before the current\n configuration. The sample shows a dependency that's defined in the same\n file. The `configs` tag can also reference other `skaffold.yaml` files in\n the current project.\n\n requires:\n - configs: [db]\n\nDeploying modules\n-----------------\n\n1. Open the Command Palette (`Ctrl`/`Cmd`+`Shift`+`P`) and then run **Cloud Code: Run on Kubernetes**.\n2. Click **Select modules**.\n3. Choose the modules that you want to deploy and then click **OK**.\n\n If you click **db** , the **db** config and the **setup** config that it\n requires are built.\n4. When prompted, choose an image registry and then press `Enter`.\n\nCleaning up\n-----------\n\nAfter you terminate your application, all Kubernetes resources deployed during\nthe run are deleted automatically.\n\nTo avoid incurring charges to your account for other resources used in this\nquickstart, be sure to delete the cluster and project you created.\n\nIf you're using Google Cloud and would like to delete just your cluster, you\ncan do so by following these steps:\n\n1. Click **Cloud Code** and then expand the **Kubernetes** explorer.\n2. Hold the pointer over your cluster name and then click open_in_new **Open in Google Cloud console**.\n3. Click **Delete** and then click **Delete**.\n\nTo delete your project (and associated resources, including any clusters):\n\n1. Go to the Projects page in the Google Cloud console:\n\n [Go to the Projects page](https://console.cloud.google.com/project)\n2. Select the project that you created for this quickstart and then click\n **Delete**.\n\n3. Type the project ID to confirm and then click **Shut down**.\n\n This shuts down the project and schedules it for deletion.\n\nWhat's next\n-----------\n\n- Learn more about [Skaffold modules](/code/docs/vscode/skaffold-modules).\n- Learn about the language-specific [debugging support](/code/docs/vscode/debug) in Cloud Code.\n- Customize your Cloud Code experience by configuring [settings](/code/docs/vscode/configuring-settings)."]]