<p>Now I am remote debugging my java program in kubernetes(v1.15.2) using kubectl proxy forward like this:</p>

<pre><code>kubectl port-forward soa-report-analysis 5018:5018 -n dabai-fat
</code></pre>

<p>I could using intellij idea to remote connect my localhost port 5018 to remote debugging my pod in kubernetes cluster in remote datacenter,but now I am facing a problem is every time I must change the pod name to redebug after pod upgrade,any way to keep a stable channel for debugging? </p>

<p>I could suggest for anyone who looks for ways to debug Java(and Go, NodeJS, Python, .NET Core) applications in Kubernetes to look at <strong>skaffold</strong>. <br/>
It simple CLI tool that uses already existing build and deploy configuration that you used to work with.
There is no need for additional installation in the cluster, modification for existing deployment configuration, etc.<br/>
Install CLI: <a href="https://skaffold.dev/docs/install/" rel="nofollow noreferrer">https://skaffold.dev/docs/install/</a><br/>
Open your project, and try:</p>
<pre><code>skaffold init
</code></pre>
<p>This will make skaffold create</p>
<p><strong>skaffold.yaml</strong></p>
<p>(the only needed config file for skaffold)</p>
<p>And then</p>
<pre><code>skaffold debug
</code></pre>
<p>Which will use your existing build and deploy config, to build a container and deploy it. If needed necessary arguments will be injected into the container, and port forwarding will start automatically.</p>
<p>For more info look at:
<a href="https://skaffold.dev/docs/workflows/debug/" rel="nofollow noreferrer">https://skaffold.dev/docs/workflows/debug/</a></p>
<p>This can provide a consistent way to debug your application without having to be aware all time about the current pod or deployment state.</p>
