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 templateCloud 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:
Ctrl
/Cmd
+Shift
+P
or click View > Command Palette) and then run Cloud Code: New Application.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.
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:
extensions.json
: prompt requesting download of related extensions when opening this projectlaunch.json
: launch configuration (of type cloudcode.kubernetes
) to run or debug the Kubernetes applicationtasks.json
: configuration information for Visual Studio Code Tasksguestbook-backend.deployment.yaml
: Pod specification for the backend nodesguestbook-frontend.deployment.yaml
: Pod specification for the frontend nodesmongo.deployment.yaml
: Pod specification for the database(backend|frontend)/app.js
: Node.js code with the web server logic(backend|frontend)/Dockerfile
: used to build the container image for our programskaffold.yaml
: config file for Skaffold, which Cloud Code uses to build, deploy and debug Kubernetes applicationsFor 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.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.
ConfigurationWhen 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 Configurationsand then edit or add configurations.
Build settingsCloud 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 configurationTo 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 applicationOnce 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.
Ctrl
/Cmd
+Shift
+P
) and then run the Cloud Code: Run on Kubernetes command.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 RegistryREGION
-docker.pkg.dev/PROJECT_ID
/REPO_NAME
Docker Hub docker.io/ACCOUNT
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.
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:
Right-click the pod you'd like to see logs from, and then click View Logs.
The Logs viewer opens.
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:
Make and Save your changes.
In the Debug Toolbar, click Pause (F6
) and then click Restart (Ctrl/Cmd + Shift + F5
) to rebuild and redeploy the application.
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.
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 detailsThe 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 nextTo 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