If you choose to use your own existing applications, you'll need to open the folder in VS Code before setting up two essential components, your run and debug configurations.
Setting up run configuration
To run an app on Kubernetes, you'll need a run configuration (in
.vscode/launch.json) to help
build and deploy your application. If your existing project doesn't have a run
configuration, you'll be guided to create one when you run the
'Run on Kubernetes' command.
Select 'Run on Kubernetes' from the Cloud Code status bar.
Select 'Add Configuration' when Cloud Code recognizes no available configurations.
This launches the Artifact Input Wizard.
For each image to be built, you can select a corresponding Dockerfile from the dropdown list. If there are multiple Dockerfiles in the project, they'll all be displayed in this list.
Once you click 'Save', you can continue with running the app, using the newly added run configuration (in .vscode/launch.json) and
Confirm whether you'd like to use the current cluster context (or switch to a preferred one).
Depending on the context chosen, you may be prompted to choose an image registry.
An output window will appear where you can track the progress of your running application. You'll also see a live stream of the logs from the running pods within the terminal output.
For a detailed walkthrough and more customization options, refer to running an application.
Setting up debugging
If your existing project doesn't have an existing launch.json in its
folder for debugging, you can add one using the Debug panel.
Navigate to the Debug panel (using the Debug view icon from the left taskbar) and select 'Add Configuration' from the dropdown menu.
Select 'Cloud Code Debug' as the environment.
Select the corresponding programming language.
This will create and open a
launch.jsonfile for your project. You can now update configuration attributes in this file to match those of your project. For more information on configuration attributes, refer to this table.