https://rancher.com/ logo
#k3d
Title
# k3d
a

adamant-kite-43734

11/09/2022, 10:17 PM
This message was deleted.
g

gifted-motorcycle-96530

11/09/2022, 10:22 PM
I have been able to debug a standalone Docker container using these instructions: https://blog.jetbrains.com/go/2020/05/06/debugging-a-go-application-inside-a-docker-container/ I have also been able to debug a Docker container running as a Pod using these instructions https://blog.jetbrains.com/go/2020/05/11/using-kubernetes-from-goland/ Combine with these instructions that explain using the
kubectl port-forward
command: https://itnext.io/debug-a-go-application-in-kubernetes-from-ide-c45ad26d8785 However, I want to do it all in YAML IaC and not have to use
kubectl port-forward
. I tried to add ports to the
<http://k3d.io/v1alpha2|k3d.io/v1alpha2>
API but was not able to get any success. Does anyone have any suggestions for what I might be doing wrong? I can package my efforts up as a repo on GitHub it that will help.
w

wide-garage-9465

11/10/2022, 9:03 AM
So where are you struggling? A
LoadBalancer
or
NodePort
type
Service
paired with the Deployment manifest should do the trick already. With k3d port-forwarding to the exposed port.
g

gifted-motorcycle-96530

11/10/2022, 7:38 PM
~Hi @wide-garage-9465 — Thanks for asking! I am using a
Service
and a
Pod
. Do I need a
Deployment
? My Service has these ports:~
Copy code
port: 8000
I tried using with port forwarding
Hi @wide-garage-9465 — Thank you for the help. I figured it out. I think I will create a Git repo or at least a Gist showing how to do it, because it took almost 3 days of beating my head against the wall to make it work!
w

wide-garage-9465

11/10/2022, 7:46 PM
So what was the trick? Curious for your notes..
g

gifted-motorcycle-96530

11/10/2022, 7:47 PM
That's the thing, there one no one trick. I had to get all 10 plates spinning at once!
The last thing that I did was expose different ports in
Dockerfile
, but without other things correctly configured that would not work. Hence I need to create a self-contained example that all works, which I need to do for my team anyway since I was researching how to do this.
But seeing the debugger finally work was a glorious feeling!!! 😍
The biggest problem I had to overcome was getting all the ports aligned correctly.
109 Views