A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/code/docs/vscode/running-an-application below:

Get started with Cloud Code for VS Code for Kubernetes

Get started with Cloud Code for VS Code for Kubernetes

Stay organized with collections Save and categorize content based on your preferences.

Cloud Code lets you create a Kubernetes application based on a sample or from an existing project.

Create an application from a template

Cloud Code comes with a collection of code sample templates to get you started quickly. To create a Kubernetes application using an existing sample, follow these steps:

  1. Launch the Command Palette (press Ctrl/Cmd+Shift+P or click View > Command Palette) and then run Cloud Code: New Application.
  2. Select Kubernetes application for the type of sample.
  3. Select a sample based on the language you'd like to use from the available options: NodeJS, Go, Python, Java.
  4. Choose a preferred application location on your local machine and then click Create new application to save.

    Cloud Code clones the sample you chose and opens your new project for use.

Sample application structure

All language sample applications have nearly the same structure. This is not the only supported structure but is recommended when starting.

For example, the Node.js Guestbook application structure looks like:

.
|---- .vscode
|      ---- launch.json
|---- kubernetes-manifests
|     |---- guestbook-backend.deployment.yaml
|     |---- guestbook-backend.service.yaml
|     |---- guestbook-frontend.deployment.yaml
|     |---- guestbook-frontend.service.yaml
|     |---- mongo.deployment.yaml
|     ---- mongo.service.yaml
|---- src
|     |---- backend
|     |     |---- Dockerfile
|     |     |---- index.js
|     |     |---- app.js
|     |     ---- package.json
|     |---- frontend
|           |---- Dockerfile
|           |---- index.js
|     |     |---- app.js
|           ---- package.json
---- skaffold.yaml

Taking a closer look at this Kubernetes Guestbook Node.js sample app, here are some key files and their uses:

Use your own application

For steps to use an existing project, see use Cloud Code with an existing Kubernetes application.

Note: For developing and testing an app, create and run the application on a non-production cluster.
For changes that will be rolled out to production, use an automated CI/CD workflow. Set your Kubernetes context

Before running your application, ensure you're set up to deploy your app to your preferred Kubernetes context. You can specify this in your configuration.

Configuration

When using the Cloud Code: Develop on Kubernetes run configuration, you can customize your deployment by configuring available settings.

To add or edit configurations, go to

Run

>

Open Configurations

and then edit or add configurations.

Build settings

Cloud Code supports Docker, Jib, and Buildpacks artifact types. Refer to the Configuring container image build preferences guide to learn about how to set your preferred builder and its relevant settings.

Customize your launch configuration

To configure how your application is run, you can customize your skaffold.yaml file.

You can also configure your launch by editing the cloudcode.kubernetes configuration in your .vscode/launch.json file.

For more information on customizing your launch configuration, see the Kubernetes in Cloud Code.

Note: Cloud Code is built to work with Cloud Build. To build an existing application using Google Cloud infrastructure, see the Skaffold docs for Cloud Build. Run your application

Once you have an application set up, you can run it on a Kubernetes cluster and view it live, by leveraging skaffold dev. You can run your application on a local cluster (like minikube or Docker Desktop), Google Kubernetes Engine, or any other Cloud provider.

Note: If you're working with a private Autopilot cluster, you might run into an image pull error when pulling an image outside of the image registry for your project, such as by using Docker Hub. To resolve this issue, you can either host the image on Artifact Registry or provide outbound internet access for your private nodes.
  1. Open the Command Palette (press Ctrl/Cmd+Shift+P) and then run the Cloud Code: Run on Kubernetes command.
  2. Confirm whether to use the current Kubernetes context to run the app in (or switch to a preferred one). For more information about setting up a Kubernetes context, see setting up configuration.
  3. If you chose a remote cluster as the context, when prompted, choose an image registry to push the images to. If your project has Artifact Registry API enabled and at least one Artifact Registry repository, you can browse to and select an existing Artifact Registry repository.

    The following samples demonstrate how to specify where container images are stored for some common registries:

    Artifact Registry REGION-docker.pkg.dev/PROJECT_ID/REPO_NAME Docker Hub docker.io/ACCOUNT
    Make sure that you're properly authenticated if you're using a private Docker Hub repository. AWS Container Repository (ECR) AWS_ACCOUNT_ID.dkr.ecr.REGION.amazonaws.com/APP Azure Container Registry (ACR) ACR_NAME.azurecr.io/APP

    Cloud Code concatenates this image registry with the image name specified in the Kubernetes manifests to generate the final image repository name.

    For more information, see the image registry handling guide.

    This choice is stored in your cloudcode.kubernetes launch configuration (found in .vscode/launch.json).

    Cloud Code builds your containers, pushes them to the registry, applies Kubernetes configurations to the cluster, and waits for the rollout.

View logs

In addition to seeing logs from running pods as a live stream in the terminal output as you're developing and running your application, you can view logs from a specific pod by navigating to the Kubernetes section.

To view logs from a specific pod, follow these steps:

  1. In the Kubernetes section, expand Deployments
  2. Right-click the pod you'd like to see logs from, and then click View Logs.

    The Logs viewer opens.

Make changes, rebuild, and clean up

If you've set watch mode to

false

in your launch configuration and you want to make changes to your application and then rebuild and redeploy the application:

  1. Make and Save your changes.

  2. In the Debug Toolbar, click Pause (F6) and then click Restart (Ctrl/Cmd + Shift + F5) to rebuild and redeploy the application.

  3. To stop running the application, in the Debug Toolbar, click Stop.

After you stop the application, all deployed Kubernetes resources are deleted from the cluster. You can change this behavior using the cleanUp flag in your launch configuration.

Store secrets

If your code includes potentially sensitive data like API keys, passwords, and certificates, it is recommended you store them as secrets. With Cloud Code, you can securely store these secrets in Secret Manager and programmatically fetch them when you need them.

For a detailed look at how you can create and manage secrets with Cloud Code, see the Secret Manager guide.

View resource details

The Kubernetes section displays clusters, namespaces, nodes, workloads (such as deployments, replicasets, pods and containers), services and ingresses, configurations (such as secrets and config maps) and storage (such as volumes). Using the Kubernetes section, you can perform unique actions on some of these resources.

See the Kubernetes overview for more information on viewing resource details.

What's next Get Support

To send feedback, report issues on

GitHub

, or ask a question on

Stack Overflow

.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Cloud Code facilitates the creation of Kubernetes applications from existing templates or projects, offering a quick start with samples in languages like NodeJS, Go, Python, and Java."],["The structure of sample applications includes key files like `launch.json` for running/debugging, deployment YAML files in `kubernetes-manifests`, source code with `Dockerfiles` in `src`, and the `skaffold.yaml` for build and deployment configurations."],["Cloud Code allows customization of the Kubernetes deployment through the `cloudcode.kubernetes` configuration, where users can define settings for build processes, such as using Docker, Jib, or Buildpacks, and configure the `skaffold.yaml` for application launches."],["Applications can be run on various Kubernetes clusters, including local setups and cloud-based services, with Cloud Code handling container building, pushing to a designated registry, and deploying configurations to the cluster."],["Users can observe live logs directly in the terminal and access specific pod logs via the Kubernetes section, and also includes features for handling secret data, making changes, rebuilding the application, as well as viewing resource details in the Kubernetes section."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4