Cloud Code leverages Skaffold under the hood to run or debug your application.
If you have an existing application already configured with Kubernetes manifests and a Dockerfile to build your images, you can open and use it with Cloud Code.
The only additional configuration necessary is a skaffold configuration
and a launch configuration
of type cloudcode.kubernetes
. Cloud Code guides you through creating these
when you run or debug your application for the first time.
Setting up configuration
If your application doesn't have the necessary Skaffold and launch configurations, you'll need to complete the following steps:
Select Run on Kubernetes or Debug on Kubernetes from the Cloud Code status bar.
In the Run/Debug on Kubernetes dialog, specify your preferred builder and its settings.
Additionally, you can customize your configuration name here.
Once you click 'Run', the newly created skaffold.yaml and
cloudcode.kubernetes
launch configuration is added to your workspace and your app will be run or ready for debugging.
Setting up configuration for applications that already have skaffold.yaml
If your application already has a skaffold.yaml file, follow these steps:
Select
Run on Kubernetes
orDebug on Kubernetes
from the Cloud Code status bar.Optionally, select your preferred skaffold.yaml file, if more than one exists in your workspace.
Optionally, select the Skaffold profile, if more than one exists in the skaffold.yaml.
The newly created
cloudcode.kubernetes
launch configuration is added to your workspace (in .vscode/launch.json) and your app will be run or ready for debugging.
Manually creating a Skaffold configuration
You may want to manually create your Skaffold configuration to define custom options. Cloud Code comes with live templating to support this.
To manually create a Skaffold configuration:
Create a new file named skaffold.yaml in the root directory of your workspace.
In the file, press
Command/Ctrl+Space
to see a list of snippet suggestions and select theSkaffold - Getting-started
snippet.Populate the image field with your project image name and the manifests field with a list of the Kubernetes resources you'd like to deploy from the IDE.
Example for Dockerfile based builds:
build: artifacts: - image: image_name deploy: kubectl: manifests: - k8s/web.yaml - k8s/backend.yaml
For comprehensive schema details, refer to the skaffold.yaml reference.