Cloud Code for IntelliJ allows you to easily debug your applications deployed to a Kubernetes cluster. You can debug an application on a local cluster (like minikube or Docker Desktop), GKE, or any other Cloud provider.
Furthermore, with Cloud Code's debugging support, you don't have
to worry about any manual setup like setting up port forwarding, installing a
debugging backend, or injecting language-specific debug arguments in the
right way. All you need is a Cloud Code-ready Kubernetes
application that includes a
skaffold.yaml configuration file.
For supported IDEs, editions, and plugins, refer to the following table:
|Java||IntelliJ IDEA||Community or Ultimate||N/A|
|Go||IntelliJ IDEA||Ultimate||Go plugin|
|Node.js||IntelliJ IDEA||Ultimate||Node.js plugin|
|Python||IntelliJ IDEA||Ultimate||Python plugin|
With Cloud Code, you can set breakpoints and debug remote applications running in containers for the following languages:
Cloud Code automatically adds an environment variable,
JAVA_TOOL_OPTIONS, with the appropriate JDWP configuration to
enable debugging. If
JAVA_TOOL_OPTIONS is already present,
Cloud Code uses existing settings specified in
Depending on the structure of your application and its image build configuration, you might have to help the debugger map your local sources to the remote sources in the container. This enables the Node debugger to correctly process your breakpoints.
You can configure this in one of the following ways:
Select the Develop on Kubernetes Run Configuration from the dropdown and then click Edit Configurations. On the Debug tab, configure the source mapping from your local application source to the source location in the remote container.
- File/directory - the local file or directory of your application running on Kubernetes.
- Remote path - the path to the file or directory running in the container on Kubernetes.
You can choose to defer this mapping to Cloud Code. When you start your debug session, Cloud Code attempts to infer this mapping automatically. The inferred mapping is presented to you in a dialog; one dialog for each artifact you are debugging.
- Local path - the local path to the root of the artifact you are debugging.
- Remote path - the path to the file or directory running in the container on Kubernetes. You can choose to override this with your own value. If you click Cancel, no mapping is applied.
To configure your application for debugging, your app must be a
Go Module-based application
and be identified as being Go-based by setting one of the
standard Go runtime environment variables
in the container, such as
GOTRACEBACK=single is the default setting for Go
GOTRACEBACK=all is a generally useful configuration.
Optionally (but recommended), your app should be built with the
-gcflags='all=-N -l' options to disable optimizations. Skaffold
Profiles are a useful
option for this purpose and can be set with the Deployment Profile
field in your Run configuration on the Build/Deploy tab.
To configure your application for debugging, ensure you meet the following prerequisites:
IDE, edition, and plugin are compatible
For compatible IDEs, editions, and plugins, see Supported IDEs.
Skaffold version is 1.25.0 or greater
You can allow Cloud Code to manage your dependencies, or point to a local Skaffold installation. See Preferences > Tools > Cloud Code > Dependencies.
Python interpreter is configured
Without a Python interpreter configured in your project, debugging won't work, as there is no way to run
pydevd, the underlying Python debugger.
IDE How to configure IntelliJ IDEA Python debugging with Cloud Code requires a Python SDK to be configured for your project.
Go to File > Project Structure and add a Python SDK in the Project tab. If none exists, add one under the SDK tab.
PyCharm Go to File > Settings > Project > Python Interpreter or for Mac OS X, PyCharm > Preferences > Project > Python Interpreter, and add a Python interpreter.
For more details, see the Skaffold debug documentation.
To start the development cycle in debug mode on your Kubernetes cluster, click the debug action for Develop on Kubernetes .
The continuous development cycle initiates in debug mode.
Cloud Code attaches a debug session:
You can now perform the tasks you normally do when debugging local code, like setting breakpoints and stepping through code, against a live Kubernetes cluster.
To end the debugging session, click the stop icon on the Develop on Kubernetes Run Configuration.