<p>I am running a kubernetes cluster with <a href="https://kind.sigs.k8s.io/" rel="nofollow noreferrer">Kind</a> configured as shown bellow:</p>
<pre><code>kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
    kubeadmConfigPatches:
      - |
        kind: InitConfiguration
        nodeRegistration:
          kubeletExtraArgs:
            node-labels: &quot;ingress-ready=true&quot;
    extraPortMappings:
      - containerPort: 80
        hostPort: ${ingress_http_port}
        protocol: TCP
      - containerPort: 443
        hostPort: ${ingress_https_port}
        protocol: TCP
networking:
  kubeProxyMode: &quot;ipvs&quot;
</code></pre>
<p>The cluster is running inside the kind-control-plane docker container:</p>
<pre><code>CONTAINER ID   IMAGE                  COMMAND                  CREATED        STATUS       PORTS                                                                 NAMES
53d9511b8282   kindest/node:v1.21.1   &quot;/usr/local/bin/entr…&quot;   5 hours ago    Up 5 hours   0.0.0.0:80-&gt;80/tcp, 0.0.0.0:443-&gt;443/tcp, 127.0.0.1:41393-&gt;6443/tcp   kind-control-plane
</code></pre>
<p>I have also successfully deployed a deployment running a nodeJs application inside a pod and i have already exposed a service to access the app through an ingress controller and everything works as expected:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: application-deployment
spec:
  ports:
    - name: http
      port: 3000
      protocol: TCP
  selector:
    app: application-deployment
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: application-deployment
spec:
  rules:
    - http:
        paths:
          - path: &quot;/&quot;
            pathType: Prefix
            backend:
              service:
                name: application-deployment
                port:
                  number: 3000
</code></pre>
<p>I am using the WebStorm IDE to develop the application running inside the pod and i am trying to configure a remote debugger to connect to the application inside the Kind cluster. I know how to configure a debugger running inside a docker container but i dont know how to run a debugger inside a kubernetes pod running in a docker container.</p>
<p>I have already tried to configure it through WebStrom with the settings bellow:</p>
<p><a href="https://i.stack.imgur.com/q7cp8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q7cp8.png" alt="enter image description here" /></a></p>
<p>And these are the settings under the <strong>Docker container settings</strong> label:</p>
<p><a href="https://i.stack.imgur.com/CfGeB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CfGeB.png" alt="enter image description here" /></a></p>
<p>Any suggestions or workarounds in order to accomplish this would be more than appreciated.</p>
<p>Thank you in advance!</p>

Charalarg
<p>Finally I managed to connect the remote debugger by following the steps described bellow:</p>
<ol>
<li>Start the node process inside the pod with the <code>--inspect-brk</code> arg in order to be able to attach a debugger. (<code>E.g. node --inspect-brk --loader ts-node/esm src/server.ts</code>)</li>
<li>Then I forwarded the debug port from the pod to my local computer by running the command <code>kubectl port-forward deploy/application-deployment 9229:9229</code></li>
<li>Finally I created an <strong>Attach to Node.js/Chrome</strong> run/debug configuration on WebStorm instead of the Node.js configuration as I tried on the beginning and everything worked like a charm.</li>
</ol>
<p><a href="https://www.jetbrains.com/help/webstorm/running-and-debugging-node-js.html" rel="nofollow noreferrer">This</a> linked helped me configure the described solution.</p>
