Skip to content

Debugging ko with Cloud Code in VS Code #1461

@Evynglais

Description

@Evynglais

Hi,

Looking for some guidance - trying to debug an app in Kubernetes using Cloud Code. I can get it to connect to the debugger, but can't get it to stop on any breakpoints.

My guess is that either the localRoot or remoteRoot is wrong, but not sure why.

TIA.

Command to apply:

ko apply --debug --disable-optimizations -f containersource.yaml

Partial ContainerSource YAML:

apiVersion: sources.knative.dev/v1
kind: ContainerSource
metadata:
  name: backend
spec:
  template:
    spec:
      containers:
        - image: ko://path/to/backend
          ports:
            - containerPort: 40000

Launch Configuration JSON:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Backend",
            "type": "cloudcode.kubernetes",
            "request": "attach",
            "language": "Go",
            "debugPort": 40000,
            "podSelector": {
                "sources.knative.dev/containerSource": "backend"
            },
            "localRoot": "${workspaceFolder}",
            "remoteRoot": "/ko-app",
        },
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions