I am running a kubernetes cluster with Kind configured as shown bellow:
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: ${ingress_http_port}
protocol: TCP
- containerPort: 443
hostPort: ${ingress_https_port}
protocol: TCP
networking:
kubeProxyMode: "ipvs"
The cluster is running inside the kind-control-plane docker container:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
53d9511b8282 kindest/node:v1.21.1 "/usr/local/bin/entr…" 5 hours ago Up 5 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 127.0.0.1:41393->6443/tcp kind-control-plane
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:
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: "/"
pathType: Prefix
backend:
service:
name: application-deployment
port:
number: 3000
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.
I have already tried to configure it through WebStrom with the settings bellow:
And these are the settings under the Docker container settings label:
Any suggestions or workarounds in order to accomplish this would be more than appreciated.
Thank you in advance!
Finally I managed to connect the remote debugger by following the steps described bellow:
--inspect-brk
arg in order to be able to attach a debugger. (E.g. node --inspect-brk --loader ts-node/esm src/server.ts
)kubectl port-forward deploy/application-deployment 9229:9229
This linked helped me configure the described solution.