Create an app with configuration dependencies

In this quickstart, you set up an application with configuration dependencies based on a sample application and then deploy parts of the app separately.

Before you begin

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Google Kubernetes Engine API.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the Google Kubernetes Engine API.

    Enable the API

  8. Install Git. Git is required for copying samples to your machine.
  9. Install the Cloud Code plugin if you haven't already.

Creating an application

  1. Clone the Bank of Anthos repository:

    1. In the top menu bar, click Terminal > New Terminal.
    2. Clone the Bank of Anthos repository:

      git clone https://github.com/GoogleCloudPlatform/bank-of-anthos.git
      
  2. To open the workspace based on Bank of Anthos, in VS Code, click File > Open folder and then navigate to the folder where the repository was cloned.

  3. Double-click the skaffold.yaml file.

    1. The file contains multiple configurations, separated by YAML document separators (---). Each configuration can be deployed or referenced as a dependency separately.

      ---
      apiVersion: skaffold/v2beta18
      kind: Config
      
    2. Configurations with a name specified are known as Skaffold modules. The following excerpt defines the frontend module.

      metadata:
      name: frontend # module defining frontend service
      
    3. Dependencies between configurations are specified using the configs tag. Required configurations must be deployed before the current configuration. The sample shows a dependency that's defined in the same file. The configs tag can also reference other skaffold.yaml files in the current project.

      requires:
      - configs: [db]
      

Deploying modules

  1. Open the Command Palette (Ctrl/Cmd+Shift+P) and then run Cloud Code: Run on Kubernetes.
  2. Click Select modules.
  3. Choose the modules that you want to deploy and then click OK.

    If you click db, the db config and the setup config that it requires are built.

  4. When prompted, choose an image registry and then press Enter.

Cleaning up

After you terminate your application, all Kubernetes resources deployed during the run are deleted automatically.

To avoid incurring charges to your account for other resources used in this quickstart, be sure to delete the cluster and project you created.

If you're using Google Cloud and would like to delete just your cluster, you can do so by following these steps:

  1. Click Cloud Code and then expand the Kubernetes explorer.
  2. Hold the pointer over your cluster name and then click open_in_new Open in Google Cloud console.
  3. Click Delete and then click Delete.

To delete your project (and associated resources, including any clusters):

  1. Go to the Projects page in the Google Cloud console:

    Go to the Projects page

  2. Select the project that you created for this quickstart and then click Delete.

  3. Type the project ID to confirm and then click Shut down.

    This shuts down the project and schedules it for deletion.

What's next