Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
App mit Konfigurationsabhängigkeiten erstellen
In dieser Kurzanleitung richten Sie eine Anwendung mit Konfigurationsabhängigkeiten basierend auf einer Beispielanwendung ein und stellen dann Teile der App separat bereit.
Hinweise
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.
Wenn Sie den auf Bank of Anthos basierenden Arbeitsbereich in VS Code öffnen möchten, klicken Sie auf Datei > Ordner öffnen und rufen Sie dann den Ordner auf, in dem das Repository geklont wurde.
Doppelklicken Sie auf die Datei skaffold.yaml.
Die Datei enthält mehrere Konfigurationen, die durch YAML-Dokumenttrennzeichen (---) getrennt sind. Jede Konfiguration kann separat bereitgestellt oder als Abhängigkeit referenziert werden.
---apiVersion:skaffold/v2beta18kind:Config
Konfigurationen mit einem angegebenen Namen werden als Skaffold-Module bezeichnet.
Im folgenden Auszug wird das Modul frontend definiert.
metadata:name:frontend# module defining frontend service
Abhängigkeiten zwischen Konfigurationen werden mit dem Tag configs angegeben. Erforderliche Konfigurationen müssen vor der aktuellen Konfiguration bereitgestellt werden. Das Beispiel zeigt eine Abhängigkeit, die in derselben Datei definiert ist. Das Tag configs kann auch auf andere skaffold.yaml-Dateien im aktuellen Projekt verweisen.
requires:-configs:[db]
Module bereitstellen
Öffnen Sie die Befehlspalette (Ctrl/Cmd+Shift+P) und führen Sie dann Cloud Code: Auf Kubernetes ausführen aus.
Klicken Sie auf Module auswählen.
Wählen Sie die Module aus, die Sie bereitstellen möchten, und klicken Sie dann auf OK.
Wenn Sie auf db klicken, werden die db-Konfiguration und die erforderliche setup-Konfiguration erstellt.
Wenn Sie dazu aufgefordert werden, wählen Sie eine Image-Registry aus und drücken Sie dann Enter.
Bereinigen
Nachdem Sie Ihre Anwendung beendet haben, werden alle während der Ausführung bereitgestellten Kubernetes-Ressourcen automatisch gelöscht.
Um Kosten für andere in dieser Kurzanleitung verwendete Ressourcen zu vermeiden, sollten Sie den Cluster und das Projekt, die Sie erstellt haben, löschen.
Wenn Sie Google Cloud verwenden und nur Ihren Cluster löschen möchten, führen Sie die folgenden Schritte aus:
Klicken Sie auf Cloud Code und maximieren Sie dann den Kubernetes Explorer.
Bewegen Sie den Mauszeiger auf den Clusternamen und klicken Sie dann auf open_in_newIn der Google Cloud Konsole öffnen.
Klicken Sie auf Löschen und dann noch einmal auf Löschen.
So löschen Sie Ihr Projekt und die zugehörigen Ressourcen, einschließlich der Cluster:
Rufen Sie in der Google Cloud Console die Seite „Projekte“ auf:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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)."]]